Skip to content

Instantly share code, notes, and snippets.

@dylanmtaylor
Created April 18, 2015 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dylanmtaylor/8a2d375963b15803e1ab to your computer and use it in GitHub Desktop.
Save dylanmtaylor/8a2d375963b15803e1ab to your computer and use it in GitHub Desktop.
An exercise in simple shell timer programming
#!/bin/bash
while [ 1 ]; do
HOUR=`date +%k`
MIN=`date +%M`
let REM="$MIN % 20"
if [ $REM = 0 ]; then
mocp -l beep-440-3s.ogg #a 440hz 3second ogg file
fi
let SET="($MIN-$REM)/20"
echo -n "Hour: $HOUR Min: $MIN Set: $SET "
let hrem="$HOUR % 2"
if [ $SET -ne 1 ]; then
if [ $hrem -ne 0 ]; then
echo "Ice On"
else
echo "Ice Off"
fi
else
if [ $hrem -ne 0 ]; then
echo "Ice Off"
else
echo "Ice On"
fi
fi
sleep 60s #wait 1 minute
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment