I was reading an article on bash in the Arch wiki today because I wanted to get some insights on aliases (turns out they should be defined in ~/.bashrc
). The article happened to contain some additional information on two programs: cowsay and fortune.
Fortune is a program that has a wealth of random quotes (some of which are a bit risque). Simply running fortune
is enough to get a random one. You can also specify whether you want short or long quotes, and whether you want to include risque ones. fortune -so
will give you a short, off-color remark. You can create your own by creating a file in /usr/share/fortune/
. I tested this by creating a few of my favoritte Bender quotes:
Bite my shiny metal ass.
%
I don't need to drink. I can quit anytime I want!
%
Oh, no room for Bender, eh? I'll build my OWN lunar landing... with blackjack, and hookers! In fact, forget the lunar lander and the blackjack! Ehh, screw the whole thing.
%
Hey! I got a busted ass here and I don't see anyone kissing *it*!
%
There. This'll teach those filthy bastards who's lovable.
I saved the above as /usr/share/fortune/bender
. The file needs to be converted into a .dat file, so I ran sudo strfile bender bender.dat
. Once this has been done, you can randomly select one by simply running fortune bender
. Cool!
cowsay is a program that has apparently been around since the dawn of (Unix) time. Basically, it is a text filter that accepts an input and renders some ASCII art of a cow saying whatever you passed it. The funny thing is that it comes bundled with a number of ASCII characters and even allows you to create your own. You can run cowsay -l
to see a list of the other possibilities, or simply ls /usr/share/cows/
. I played around with these files and made my own:
$the_cow = <<EOC;
$thoughts
$thoughts
( )
H
H
_H_
.-'-.-'-.
/ \
| |
| .-------'._
| / / '.' '. \
| \ \ @ @ / /
| '---------'
| _______|
| .'-+-+-+|
| '.-+-+-+|
| """""" |
'-.__ __.-'
EOC
The funny thing is that cowsay can accept text from the standard input, which means fortune can pass it a random phrase, and your ASCII art can say it. So since I have Bender quotes and a Bender ASCII, why not put them together? fortune bender | cowsay -f bender
is enough to generate:
__________________________
< Bite my shiny metal ass. >
--------------------------
\
\
( )
H
H
_H_
.-'-.-'-.
/
| |
| .-------'._
| / / '.' '.
| @ @ / /
| '---------'
| _______|
| .'-+-+-+|
| '.-+-+-+|
| """""" |
'-.__ __.-'
Lulz. The final piece – the one that led me to these gems in the first place – is bash. I simply appended fortune bender | cowsay -f bender
to the end of my ~/.bashrc
file, so that every time I open up a new terminal, I get to see Bender’s face and words of wisdom. Maybe I’ll do Homer Simpson once I get tired of this.
In any case, stupid stuff like this is just one of the many reasons I love Linux.