Darkland | net

Latest Iteration Of Timer Script

Published on 30 December 2015 by Amanda

This script calls an external tk file which is linked to at the bottom of the page only because I haven't figured out how to run the file from within the script.
#!/bin/bash
############################
# This is a rewrite of a script that
# originally ran for a preset length
# of time. It now runs for an arbitrary
# number of minutes.
#
# Reference(s):
# http://www.commandlinefu.com/commands/view/7938/countdown-clock
# http://www.shelldorado.com/goodcoding/cmdargs.html
# http://stackoverflow.com/questions/699576/validating-parameters-to-a-bash-script
# http://unix.stackexchange.com/questions/151654/checking-if-an-input-number-is-an-integer
#
############################
##  Change log            ##
############################
##
##
############################
##
i="0"
MIN="0"
while [ $i -lt 1 ]
    do
    read -p "Minutes : " MIN 
        if [[ $MIN =~ ^[0-9]+$ ]] ; then
            i=$[$i + MIN]
        else
printf "usage:\t
         Minutes : [integer]."
        fi
done
if [ "$1" ] ; then
    case "$1" in
$(date -d"0+$i sec" +%H:%M:%S)"; sleep 1; done; python $HOME/bin/timer.tk & play -n -c2 -q synth sin %0 fade h 0.8 0.25 0.8 repeat 30 & echo -e "
"
                exit 0;;
        -*) echo >&2 "usage: timer [-a]"
                exit 1;;
        *) echo >&2 "usage: timer [-a]"
             exit 1;;
    esac
else
$(date -d"0+$i sec" +%H:%M:%S)"; sleep 1; done; python $HOME/bin/timer.tk & echo -e "
"

fi
exit
External tk file: timer.tk
Back