Create custom fortunes for the fortune command
Open an editor of your choice and add the messages you like to be shown when running the command ‘fortune’. Be sure to add a separate line containing the character % between message. Below is an example I made from quotes from the site protolol:
Comic Sans walks into a bar and the barman says “We don’t serve your type here”
%
The problem with 802.11 jokes is they probably go over your head.
%
Whats the worst thing about sending a joke in TCP? I’ll keep telling it slower and slower until you get it.
%
If you see an Apple Store getting robbed, you are an iWitness
%
NTP jokes arrive always on time
%
When done adding messages to the file run the command:
strfile % -c yourfile yourfile.dat
This will create a binary search index, the .dat file. Both files must be named the same and should be placed in “/usr/share/games/fortunes/”.
To see your fortune just type:
fortune yourfile
If you want a fortune to be displayed when opening a shell, add the following to the file ~/.bashrc:
fortune /path/to/yourfile
If you like to download my protolol fortune you can find it here
Leave a Reply