I want to get a BASH terminal flashing. The goal is to get the terminal to flash between two colours, say white and black, substantially, using standard Linux utilities. I don't mind if the terminal is filled with characters and cleared in order to do this. A rough picture of what this could look like is as follows: 
4 Answers
You can toggle between normal and reverse video with the following shell commands:
printf '\e[?5h' # Turn on reverse video
printf '\e[?5l' # Turn on normal video
8 Comments
Serge Ballesta
Nitpicking: this one depends on the terminal emulation. Ok now almost every emulator supports this ANSI code, but there used to be many other terminal, just look at the terminfo database... But you are right, this is what OP asked for :-)
chepner
Yeah, I was looking into the correct way of using
terminfo or termcap (I can't even remember which one is the modern database and/or which is horribly obsolete), but couldn't track it down quickly so I just left this. (These are ANSI escape characters, so most common terminals should support them.)Serge Ballesta
terminfo is the young one, termcap is the grandaddy from the 70s. I remember TeleVideo terminals that did not know ANSI sequences. Snff, maybe I could still find one in a museum...
d3pd
@chepner Thank you very much for your assistance. These ANSI codes are exactly what I need.
d3pd
@SergeBallesta Thank you for your illuminating comments. I'm using GNOME Terminal and xterm, both of which are fairly standard and can recognise the ANSI codes.
|
What you are asking is called the visible bell. It can be enabled on major terminal emulators like xterm (Ctrl + middle button menu) or putty( Settings/Terminal/Bell). Unfortunately, there is no general way to do it.
But once it has been done, echo Ctrl+G causes the terminal to flash instead of beeping.
3 Comments
chepner
The visible bell is just one application of flashing; I think the OP wants to know how to actually tell the terminal how to flash.
chepner
That triggers the bell, which the terminal may or may not (depending on the setting), display using flashing. But what is the actual terminal command that will causing flashing, whether or not the visible bell is set?
d3pd
@SergeBallesta Thank you for your informative comments on the visible bell. The solution provided by chepner is more direct, but your solution is informative in a more general way.
notify-sendwhich is a bit less verbose.