Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BASH: how can the terminal be set to flash?

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:

like image 761
d3pd Avatar asked Aug 14 '15 12:08

d3pd


People also ask

What is a Bash terminal in Linux?

A Bash Terminal is a terminal that has been set to use the Bash Shell. Shell scripts are commands that are in the order in which they are to be executed. They are text files that use the .sh extension and are used to perform operations involving file manipulation, program execution, and text printing.

How to make a bash script run when terminal starts up?

Probably the simplest one is to add call to your script at the end of .bashrc file, as stated in the comment. However, this will cause your script run not only when a terminal starts up, but also when you for example log in to the text console (reachable by pressing Ctrl+Alt+F4 for example), or when you log in remotely via ssh.

How do I enable Flash in Linux terminal?

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.

Is there a way to force a bash script to flush?

Instead, the commands it invokes as part of the script will each individually write output and flush whenever they feel like it. So your question is really how to force the commands within the bash script to flush, and that depends on what they are. Show activity on this post. You can use tee to write to the file without the need for flushing.


1 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
like image 68
chepner Avatar answered Sep 30 '22 17:09

chepner