i'd like to use a beep sound in a shell script. Unfortunately none the methods i found via google does work for me.
echo -e '\a' echo -ne '\007'
and the command
beep after i installed it via apt.
What could be the reason?
The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.
If this works for you then to enable the loading of pcspkr permanently edit the
# ugly and loud noise, getting on everyone's nerves; this should be done by a # nice pulseaudio bing (Ubuntu: #77010) # blacklist pcspkr
Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.
First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it
Then have have it available as a command
Now just run
If you have actual speakers connected to the computer and you're not getting a beep it's likely because you are using compiz. Compiz is relying on pulseaudio catching the beeps and playing them while metacity bypasses the usual setup and uses libcanberra to play a beep sound. If it works with metacity and not compiz that is your problem, otherwise the answer htorque gave is corrent.