# note you'll have to put the binbash header on the first line #inaccurate demonstration script to tell time #quiet="-q" preamble="time_is_now" postamble="buzz" sayhours="hours" sayminutes="minutes" sayseconds="seconds" num[1]="one" num[2]="two" num[3]="three" num[4]="four" num[5]="five" num[6]="six" num[7]="seven" num[8]="eight" num[9]="nine" num[10]="ten" num[11]="eleven" num[12]="twelve" num[13]="thirteen" num[14]="fourteen" num[15]="fifteen" num[16]="sixteen" num[17]="seventeen" num[18]="eighteen" num[19]="nineteen" num[20]="twenty" num[30]="thirty" num[40]="fourty" num[50]="fifty" t=`date +"%I %M %S %p"` re="^0?([0-9]+) 0?([0-9]+) 0?([0-9]+) ([AP]M)$" [[ $t =~ $re ]] && h="${BASH_REMATCH[1]}" && m="${BASH_REMATCH[2]}" && s="${BASH_REMATCH[3]}" && ampm="${BASH_REMATCH[4]}" ampm=`echo $ampm | awk '{print tolower($0)}'` hour=${num[$h]} min=${num[$m]} sec=${num[$s]} if [ -z "$min" ] then mu=$(($m%10)) mm=$(($m-$mu)) min=${num[$mm]} minu=${num[$mu]} fi if [ -z "$sec" ] then su=$(($s%10)) ss=$(($s-$su)) sec=${num[$ss]} secu=${num[$su]} fi aplay $quiet fvox/$preamble.wav aplay $quiet fvox/$hour.wav aplay $quiet fvox/$min.wav if [ -n "$minu" ] then aplay $quiet fvox/$minu.wav fi aplay $quiet fvox/$ampm.wav aplay $quiet fvox/$postamble.wav