Skip to content

Instantly share code, notes, and snippets.

@benfb
Created April 3, 2011 04:25
Show Gist options
  • Save benfb/900179 to your computer and use it in GitHub Desktop.
Save benfb/900179 to your computer and use it in GitHub Desktop.
The kitty says 'still alive.'
Tonight I decided to set something interesting to happen every time I open the Terminal.
I decided to use cowsay (http://www.nog.net/~tony/warez/cowsay.shtml)
and fortune (http://en.wikipedia.org/wiki/Fortune_(Unix) to have a "cow" (kitten in my case)
give out random quotes from Portal, the Hitchhiker's Guide to the Galaxy and Monty Python and the Holy Grail.
I was successful, and decided to share my method.
First, you should install both programs:
brew install fortune
brew install cowsay
Then navigate to where the random things fortune says are stored:
cd /usr/local/Cellar/fortune/9708/share/games/
You want to make a new file, so use your favorite text editor and create a file with the name portal:
mate portal
The format of these files is:
QUOTE
%
QUOTE
Add quotes until you're done, then save the file and close it. Next,
create a database (.dat) file out of it that fortune can read.
(To make this easier for future use, in my aliases file I put added a new
alias--alias mkfortune="strfile $1"--but this isn't necessary).
strfile portal
Now that you have one database, create any others you want.
Lastly, I placed the final command in the ~/.bashrc file which runs every time you open a new bash session:
fortune 34% portal 33% hg 33% monty | cowsay -s -f kitty.cow
In this case, fortune displays a random quote with equal probability from Portal, HHGTTG,
and Monty Python, then gives the output to cowsay, which displays/shows the quote in a speech
bubble coming out of a stoned kitty.
Type man cowsay and man fortune for other options/cool tricks. regarding the commands.
@h3h
Copy link

h3h commented Apr 3, 2011

Hah, nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment