Copyright (C) 2000-2012 |
Manpages FORTUNESection: UNIX Reference Manual (6)Updated: 19 April 94 [May. 97] Index Return to Main Contents NAMEfortune - print a random, hopefully interesting, adageSYNOPSISfortune [-aefilosw] [-n length] [ -m pattern] [[n%] file/dir/all]DESCRIPTIONWhen fortune is run with no arguments it prints out a random epigram. Epigrams are divided into several categories, where each category is sub-divided into those which are potentially offensive and those which are not.OptionsThe options are as follows:
The user may specify alternate sayings. You can specify a specific file, a directory which contains one or more files, or the special word all which says to use all the standard databases. Any of these may be preceded by a percentage, which is a number n between 0 and 100 inclusive, followed by a %. If it is, there will be a n percent probability that an adage will be picked from that file or directory. If the percentages do not sum to 100, and there are specifications without percentages, the remaining percent will apply to those files and/or directories, in which case the probability of selecting from one of them will be based on their relative sizes. As an example, given two databases funny and not-funny, with funny twice as big (in number of fortunes, not raw file size), saying
The -e option says to consider all files equal; thus
For example, assuming there is a database named definitions in both the inoffensive and potentially offensive collections, then the following command will select an inoffensive definition 90% of the time, and a potentially offensive definition for the remaining 10%:
FILESNote: these are the defaults as defined at compile time.
If a particular set of fortunes is particularly unwanted, there is an easy solution: delete the associated .dat file. This leaves the data intact, should the file later be wanted, but since fortune no longer finds the pointers file, it ignores the text file. BUGSThe division of fortunes into offensive and non-offensive by directory, rather than via the `-o' file infix, is not 100% compatible with original BSD fortune. Although the `-o' infix is recognised as referring to an offensive database, the offensive database files still need to be in a seperate directory. The workaround, of course, is to move the `-o' files into the offensive directory (with or without renaming), and to use the -a option.The supplied fortune databases have been attacked, in order to correct orthographical and grammatical errors, and particularly to reduce redundancy and repetition and redundancy. But especially to avoid repititiousness. This has not been a complete success. In the process, some fortunes may also have been lost. The fortune databases are now divided into a larger number of smaller files, some organized by format (poetry, definitions), and some by content (religion, politics). There are parallel files in the main directory and in the offensive files directory (e.g., fortunes/definitions and fortunes/off/definitions). Not all the potentially offensive fortunes are in the offensive fortunes files, nor are all the fortunes in the offensive files potentially offensive, probably, though a strong attempt has been made to achieve greater consistency. Also, a better division might be made. HISTORYThis version of fortune is based on the NetBSD fortune 1.4, but with a number of bug fixes and enhancements.The original fortune/strfile format used a single file; strfile read the text file and converted it to null-delimited strings, which were stored after the table of pointers in the .dat file. By NetBSD fortune 1.4, this had changed to two separate files: the .dat file was only the header (the table of pointers, plus flags; see strfile.h), and the text strings were left in their own file. The potential problem with this is that text file and header file may get out of synch, but the advantage is that the text files can be easily edited without resorting to unstr, and there is a potential savings in disk space (on the assumption that the sysadmin kept both .dat file with strings and the text file). Many of the enhancements made over the NetBSD version assumed a Linux system, and thus caused it to fail under other platforms, including BSD. The source code has since been made more generic, and currently works on SunOS 4.x as well as Linux, with support for more platforms expected in the future. Note that some bugs were inadvertantly discovered and fixed during this process. At a guess, a great many people have worked on this program, many without leaving attributions. SEE ALSOre_comp(3), regcomp(3), strfile(1), unstr(1)
IndexThis document was created by man2html, using the manual pages. Time: 09:34:54 GMT, December 14, 2024 |