How can I create a fortunes file and add it to the fortune
* command on the shell?
*Fortune – "console command to print a random, hopefully interesting, adage."
command linefortune
How can I create a fortunes file and add it to the fortune
* command on the shell?
*Fortune – "console command to print a random, hopefully interesting, adage."
Best Answer
This is explained in the manpages for
fortune(6)
and (especially)strfile(1)
.Basically, you create a text file that contains your "fortune cookies" separated by a line that contains a single
%
sign and nothing else. Each fortune cookie can be 1 or more lines (including empty lines). A random example from one of the default fortune cookie files:Then you use the
strfile
utility to create a binary search index (see its manpage for extra options). When you put both the text file and the binary index file in/usr/share/games/fortunes/
, your new fortune cookies should be available.