Created
January 9, 2013 02:41
-
-
Save bkendzior/4490101 to your computer and use it in GitHub Desktop.
Have a random cow tell you fortunes
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
# Have a random cow tell you fortunes | |
function cowsayfortune { | |
NUMOFCOWS=`cowsay -l | tail -n +2 | wc -w` | |
WHICHCOW=$((RANDOM%$NUMOFCOWS)) | |
THISCOW=`cowsay -l | tail -n +2 | sed -e 's/\ /\'$'\n/g' | sed $WHICHCOW'q;d'` | |
#echo "Selected cow: ${THISCOW}, from ${WHICHCOW}" | |
fortune | cowsay -f $THISCOW -W 100 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment