Monday, July 1, 2013

Fortune Cookie

Fortune cookie is an interesting program in Unix-like system. I used it when install Slackware Linux in my PC more than 15 years ago. Today I re-install it in my iMac and used with cowsay and lolcat.
1. Install Xcode command line tools. (its size is much smaller than Xcode)
2. Install Homebrew
3. terminal--->brew install fortune-mod cowsay
4. Add rainbow effect with lolcat. Install it with gem.


More fancy staffs can be added to .profile to change the cow file randomly when you start terminal.
COWDIR=/usr/local/Cellar/cowsay/3.03/share/cows/
COWNUM=$[$[RANDOM%$(ls $COWDIR | wc -l)]+1]
COWFILE=$(ls $COWDIR | sed -n ''$COWNUM'p')
fortune | cowsay -f $COWFILE| lolcat



No comments: