Skip to content

Instantly share code, notes, and snippets.

@kaezarrex
Created April 29, 2012 19:01
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 kaezarrex/2552706 to your computer and use it in GitHub Desktop.
Save kaezarrex/2552706 to your computer and use it in GitHub Desktop.
Twister
#!/bin/bash
EXPECTED_ARGS=1
E_BADARGS=65
CMDS="say espeak"
exists=false
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` <seconds>"
exit $E_BADARGS
fi
for i in $CMDS
do
type -P $i &>/dev/null && { exists=true; speak=$i; }
done
if ! $exists
then
echo "No text to speach command found"
exit 1
fi
while true
do
case $[ $RANDOM % 4 ] in
0) $speak "right foot"
;;
1) $speak "left foot"
;;
2) $speak "right hand"
;;
3) $speak "left foot"
;;
esac
case $[ $RANDOM % 4 ] in
0) $speak "red"
;;
1) $speak "yellow"
;;
2) $speak "green"
;;
3) $speak "blue"
;;
esac
sleep $1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment