Could someone help me. I need a bash script to play a short sound file, wait for 30 seconds, play another sound file, wait for another 30 seconds.
(I will use it as a reminder to spend 30 seconds on each quadrant of my teeth when using a electric toothbrush.)
mpg123 /usr/share/sounds/My_Sounds/Alarm_Clock_Sound.mp3
sleep 30
mpg123 /usr/share/sounds/My_Sounds/Alarm-sound-buzzer.mp3
sleep 30
mpg123 /usr/share/sounds/My_Sounds/facility-alarm.mp3
sleep 30
But it only plays the first sound file. ??
I have to say, this is one of the strangest reasons I have ever heard (electric toothbrushes have builtin timers these days) :D ... Probably, you'd prefer your computer to give you spoken instructions as well like so:
Or make it less chattering like so:
Or use the
timeout
command with your player and audio files like so:or with
sleep
and the Bash builtinkill
like so:Or play each file once then wait 30 seconds and move on to the next file like so:
A few years ago I posted a bash script here in Ask Ubuntu that addresses the multiple-timer issue:
However, it allows only one custom sound file used on all the alarms.
Since then I wrote a Javascript version that runs on the Chrome or Firefox browser on any device:
The advantage of this major rewrite is you can run the timers on your smartphone and bring it to your washroom. It runs on Ubuntu of course but dragging your computer to the sink to brush your teeth is not ideal.
The other advantage of Tim-ta is you can have unlimited custom sound files uploaded and pick from them for each timer.