Created
April 18, 2015 09:32
-
-
Save dylanmtaylor/8a2d375963b15803e1ab to your computer and use it in GitHub Desktop.
An exercise in simple shell timer programming
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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