Created
June 2, 2015 02:43
-
-
Save khchanel/2425f2339921c2d1cec5 to your computer and use it in GitHub Desktop.
fortune telling with random cowsay
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 | |
# cowsayfortune | |
# Author: Nelson Chan <khchanel> | |
# | |
# fortune telling with random cowsay | |
# change paths accordingly for your system | |
FORTUNE="/usr/local/Cellar/fortune/*/bin/fortune" | |
COWSAY="/usr/local/Cellar/cowsay/*/bin/cowsay" | |
SHUF="/usr/local/Cellar/coreutils/*/bin/gshuf" | |
COWSAY_PATH="/usr/local/Cellar/cowsay/*/share/cows" | |
GREEN='\033[0;32m' | |
NOCOLOR='\033[0m' | |
if [ -x ${COWSAY_PATH} -a -x ${FORTUNE} -a -x ${SHUF} ]; then | |
echo -e ${GREEN} | |
${FORTUNE} | ${COWSAY} -f "$(ls ${COWSAY_PATH} | ${SHUF} -n1)" | |
echo -e ${NOCOLOR} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment