Reputation: 8315
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:
Upvotes: 5
Views: 6069
Reputation: 191
Here's a tiny bash script i use for this purpose. It also resets the terminal when you ctrl-c.
#!/usr/bin/env bash
set -e
trap ctrl_c INT
function ctrl_c() {
printf '\e[?5l'
}
while true; do
printf '\e[?5h'
sleep 0.5
printf '\e[?5l'
sleep 0.5
done
Upvotes: 5
Reputation: 729
You can can call Python inline from Bash as follows
python -c 'import curses ; w=curses.initscr() ; curses.flash() ; curses.endwin() '
Upvotes: 1
Reputation: 531808
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
Upvotes: 11
Reputation: 149075
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.
Upvotes: 1