Home > bash > beep when ready

beep when ready

Problem
Sometimes I launch a script and if it takes too much time to finish, I leave the machine alone. I do something else but I check back from time to time to see if it has finished. It would be nice if I could get an audio notification when the job is done.

Idea
Here it is:

$ ./slow_operation.sh; beep

Implementation
There is a package called “beep” that should do it but it was mute on my system, so I came up with an own solution. First, you need a short audio file. Here is mine: alert.wav. Download it and put it in the directory $HOME/bin. Make sure $HOME/bin is in your PATH.

Then add the following lines to your ~/.bashrc file:

#uncomment the next 2 lines to add $HOME/bin to your PATH
#PATH=$PATH:$HOME/bin
#export PATH

alias beep="mplayer -ao alsa $HOME/bin/alert.wav &>/dev/null"

Test
Open a new terminal and try this:

$ sleep 2; beep
Categories: bash Tags: , , ,
  1. June 29, 2013 at 08:35

    Reblogged this on Yash Jhunjhunwala.

  1. No trackbacks yet.

Leave a comment