Skip to content

Instantly share code, notes, and snippets.

@AlessioGiambrone
Created February 7, 2017 14:55
Show Gist options
  • Save AlessioGiambrone/0315f9effdd181ee53132fe3410b60cf to your computer and use it in GitHub Desktop.
Save AlessioGiambrone/0315f9effdd181ee53132fe3410b60cf to your computer and use it in GitHub Desktop.
#!/bin/bash
# Inutility that speaks all the numbers of a specified countdown
# You can also specify the language (e.g. en, it, da)
if [ -v $@ ]
then
underline=`tput smul`
nounderline=`tput rmul`
echo "Usage: countdown ${underline}SECONDS${nounderline} [${underline}LANGUAGE${nounderline}]"
exit 1
fi
if [ -v $2 ]
then
lang=`echo $LANG | cut -d '_' -f 1`;
else
lang=$2
fi
for number in $(seq "$1" -1 0);
do
echo $number
vel=160
if [ $number -gt 1000 ]
then
vel=350
elif [ $number -gt 100 ]
then
vel=220
fi
espeak -s $vel -v$lang+f5 $number & sleep 1
done
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment