43

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).

9
  • 11
    Downvoting without an explanation is not very useful...
    – Sekhemty
    Sep 6, 2015 at 14:19
  • unix.stackexchange.com/q/1974/1932
    – paradroid
    Sep 6, 2015 at 14:19
  • 2
    These solutions aren't working for me.
    – Sekhemty
    Sep 6, 2015 at 14:27
  • 4
    What does your research tell you? What exactly have you tried and what didn't work?
    – slhck
    Sep 6, 2015 at 14:41
  • 2
    ( speaker-test -t sine -f 440 )& pid=$! ; sleep 0.4s ; kill -9 $pid requires ALSA installed. Always from one of that answers
    – Hastur
    Sep 8, 2015 at 13:20

2 Answers 2

56
tput bel

is a relatively portable solution.

3
  • "tput bel" works on macOS, as it should. Dec 14, 2017 at 15:46
  • Works on Cygwin bash terminal as well.
    – ysap
    Aug 10, 2018 at 17:25
  • Works on CentOS 7 bash via macOS terminal.
    – rinogo
    Sep 3, 2020 at 14:59
19

Try this command:

echo -e "\07"
2
  • 1
    N.B. The -e is needed to enable interpretation of the \07 escape sequence. Nov 27, 2017 at 11:20
  • Works on Cygwin bash terminal as well.
    – ysap
    Aug 10, 2018 at 17:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.