How do I ring the terminal bell during a shell script?
The answer depends on your Unix version (or rather on the kind of"echo" program that is available on your machine).
A BSD-like "echo" uses the "-n" option for suppressing the final
newline and does not understand the octal \nnn notation. Thus
the command is
echo -n '^G'
where ^G means a _literal_ BEL-character (you can produce this in
emacs using "Ctrl-Q Ctrl-G" and in vi using "Ctrl-V Ctrl-G").
A SysV-like "echo" understands the \nnn notation and uses \c to
suppress the final newline, so the answer is:
echo '\007\c'
Home | FAQ |