1FORTUNE(6) UNIX Reference Manual FORTUNE(6)
2
3
4
6 fortune - print a random, hopefully interesting, adage
7
9 fortune [-acefilosw] [-n length] [ -m pattern] [[n%] file/dir/all]
10
12 When fortune is run with no arguments it prints out a random epigram.
13 Epigrams are divided into several categories..SS Options The options
14 are as follows:
15
16 -a Choose from all lists of maxims.
17
18 -c Show the cookie file from which the fortune came.
19
20 -e Consider all fortune files to be of equal size (see discussion
21 below on multiple files).
22
23 -f Print out the list of files which would be searched, but don't
24 print a fortune.
25
26 -l Long dictums only. See -n on how ``long'' is defined in this
27 sense.
28
29 -m pattern
30 Print out all fortunes which match the basic regular expression
31 pattern. The syntax of these expressions depends on how your
32 system defines re_comp(3) or regcomp(3), but it should neverthe‐
33 less be similar to the syntax used in grep(1).
34
35 The fortunes are output to standard output, while the names of
36 the file from which each fortune comes are printed to standard
37 error. Either or both can be redirected; if standard output is
38 redirected to a file, the result is a valid fortunes database
39 file. If standard error is also redirected to this file, the
40 result is still valid, but there will be ``bogus'' fortunes,
41 i.e. the filenames themselves, in parentheses. This can be use‐
42 ful if you wish to remove the gathered matches from their origi‐
43 nal files, since each filename-record will precede the records
44 from the file it names.
45
46 -n length
47 Set the longest fortune length (in characters) considered to be
48 ``short'' (the default is 160). All fortunes longer than this
49 are considered ``long''. Be careful! If you set the length too
50 short and ask for short fortunes, or too long and ask for long
51 ones, fortune goes into a never-ending thrash loop.
52
53 -s Short apothegms only. See -n on which fortunes are considered
54 ``short''.
55
56 -i Ignore case for -m patterns.
57
58 -w Wait before termination for an amount of time calculated from
59 the number of characters in the message. This is useful if it
60 is executed as part of the logout procedure to guarantee that
61 the message can be read before the screen is cleared.
62
63 The user may specify alternate sayings. You can specify a specific
64 file, a directory which contains one or more files, or the special word
65 all which says to use all the standard databases. Any of these may be
66 preceded by a percentage, which is a number n between 0 and 100 inclu‐
67 sive, followed by a %. If it is, there will be a n percent probability
68 that an adage will be picked from that file or directory. If the per‐
69 centages do not sum to 100, and there are specifications without per‐
70 centages, the remaining percent will apply to those files and/or direc‐
71 tories, in which case the probability of selecting from one of them
72 will be based on their relative sizes.
73
74 As an example, given two databases funny and not-funny, with funny
75 twice as big (in number of fortunes, not raw file size), saying
76
77 fortune funny not-funny
78
79 will get you fortunes out of funny two-thirds of the time. The command
80
81 fortune 90% funny 10% not-funny
82
83 will pick out 90% of its fortunes from funny (the ``10% not-funny'' is
84 unnecessary, since 10% is all that's left).
85
86 The -e option says to consider all files equal; thus
87
88 fortune -e funny not-funny
89
90 is equivalent to
91
92 fortune 50% funny 50% not-funny
93
94
96 Note: these are the defaults as defined at compile time.
97
98 /usr/share/games/fortune
99 Directory for innoffensive fortunes.
100
101 If a particular set of fortunes is particularly unwanted, there
102 is an
103 easy solution: delete the associated .dat file. This leaves the
104 data intact, should the file later be wanted, but since fortune
105 no longer finds the pointers file, it ignores the text file.
106
108 The supplied fortune databases have been attacked, in order to correct
109 orthographical and grammatical errors, and particularly to reduce
110 redundancy and repetition and redundancy. But especially to avoid rep‐
111 etitiousness. This has not been a complete success. In the process,
112 some fortunes may also have been lost.
113
114 The fortune databases are now divided into a larger number of smaller
115 files, some organized by format (poetry, definitions), and some by con‐
116 tent (religion, politics).
117
119 This version of fortune is based on the NetBSD fortune 1.4, but with a
120 number of bug fixes and enhancements.
121
122 The original fortune/strfile format used a single file; strfile read
123 the text file and converted it to null-delimited strings, which were
124 stored after the table of pointers in the .dat file. By NetBSD fortune
125 1.4, this had changed to two separate files: the .dat file was only the
126 header (the table of pointers, plus flags; see strfile.h), and the text
127 strings were left in their own file. The potential problem with this
128 is that text file and header file may get out of synch, but the advan‐
129 tage is that the text files can be easily edited without resorting to
130 unstr, and there is a potential savings in disk space (on the assump‐
131 tion that the sysadmin kept both .dat file with strings and the text
132 file).
133
134 Many of the enhancements made over the NetBSD version assumed a Linux
135 system, and thus caused it to fail under other platforms, including
136 BSD. The source code has since been made more generic, and currently
137 works on SunOS 4.x as well as Linux, with support for more platforms
138 expected in the future. Note that some bugs were inadvertently discov‐
139 ered and fixed during this process.
140
141 At a guess, a great many people have worked on this program, many with‐
142 out leaving attributions.
143
145 re_comp(3), regcomp(3), strfile(1), unstr(1)
146
147
148
149BSD Experimental 19 April 94 [May. 97] FORTUNE(6)