Created
April 29, 2012 19:01
-
-
Save kaezarrex/2552706 to your computer and use it in GitHub Desktop.
Twister
This file contains 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 | |
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