1)First of all, create a file containing the fortunes that you want to display. Begin the contents of the file with a % sign. Then fill it with the phrases, expressions or sayings of your choice. Remember to separate each phrase using the % sign.
2)Generate a ".dat" file for the file that was created in step 1. This can be done by using the "strfile" command as shown below:
- Code: Select all
strfile -r filename
Now a ".dat" file with the same name as the file created in step 1 will be generated.
3)Go to the directory "/usr/share/games/fortunes" (with administrator privileges!). This directory may vary and can be found out from fortune man page.
4)Simply copy and paste the files created in steps 1 and 2 into the directory in step 3.
5)Prevent sayings by Shakespeare or other people(no Offense!) from popping up by deleting their corresponding ".dat" files.(I strongly advice you to make a backup of these ".dat" files before getting rid of them!)
Close the directory and you are good to go! Show it off to your "Windows obsessed" friends. Let them know about the Flexibility that Linux offers!
Some really witty maxims from Mark Twain's Pudd'nhead Wilson are available at the following links(Courtesy hinto):
ONLY for those who like to get to the bottom of things:
strfile command as described in its man-page "reads a file containing groups of lines separated by a line containing a single percent `%' sign (or other specified delimiter character) and creates a data file which contains a header structure and a table of file offsets for each group of lines." This header and offset table are used by the fortune program to display the fortunes contained in a particular file. When a particular entry in the offset table is added to the header value, it points to the corresponding fortune which then gets displayed. The "-r" option causes the entries in the offset table to be arranged randomly. This is because, even if the offset table entries were read in a sequential manner we will still get randomized fortunes.
unstr command takes the ".dat" data file as input and prints the contents of the original file (the one containing fortunes separated by '%' character) in the order in which the offset table entries were made.