85

I'm using some Bash scripts under Linux that require some time to complete; I'd like to add at the end of them a command to ring the system bell when those tasks are done, so I can be notified.

What's the proper command to do that? (please note that what I need is to be notified, with a sound and possibly with a message, so I can accept any solution in these regards).

Sekhemty
  • 9,916

2 Answers2

92
tput bel

is a relatively portable solution.

gnucchi
  • 1,051
42

Try this command:

echo -e "\07"

or

echo -e "\a"

They are the same. "07" is an octal representation of BEL (bell) character in ASCII, and "a" stands for "alert", the letter is probably easier to remember. As mentioned in the comments, the -e switch enables escape sequences. Also, you can append a message directly after the escape character like this: "\aSuccess!".

Rolnik
  • 1,807