1FORTUNE(6)                   UNIX Reference Manual                  FORTUNE(6)
2
3
4

NAME

6       fortune - print a random, hopefully interesting, adage
7
8

SYNOPSIS

10
11
12                 fortune     [-acefilosw]
13                    [-n length]
14                    [-m pattern]
15                    [[n%] file/dir/all]
16
17

DESCRIPTION

19       When fortune is run with no arguments it prints out a random epigram.
20       Epigrams are divided into several categories.
21
22
23   Options
24       The options are as follows:
25
26
27       -a
28
29           Choose from all lists of maxims.
30
31
32       -c
33
34           Show the cookie file from which the fortune came.
35
36
37       -e
38
39           Consider all fortune files to be of equal size (see discussion
40           below on multiple files).
41
42
43       -f
44
45           Print out the list of files which would be searched, but don't
46           print a fortune.
47
48
49       -l
50
51           Long dictums only. See -n on how “long” is defined in this sense.
52
53
54       -m pattern
55
56           Print out all fortunes which match the basic regular expression
57           pattern. The syntax of these expressions depends on how your system
58           defines re_comp(3) or regcomp(3), but it should nevertheless be
59           similar to the syntax used in grep(1).
60
61           The fortunes are output to standard output, while the names of the
62           file from which each fortune comes are printed to standard error.
63           Either or both can be redirected; if standard output is redirected
64           to a file, the result is a valid fortunes database file. If
65           standard error is also redirected to this file, the result is still
66           valid, but there will be “bogus” fortunes, i.e. the filenames
67           themselves, in parentheses. This can be useful if you wish to
68           remove the gathered matches from their original files, since each
69           filename-record will precede the records from the file it names.
70
71
72       -n length
73
74           Set the longest fortune length (in characters) considered to be
75           “short” (the default is 160). All fortunes longer than this are
76           considered “long”. Be careful! If you set the length too short and
77           ask for short fortunes, or too long and ask for long ones, fortune
78           goes into a never-ending thrash loop.
79
80
81
82       -s
83
84           Short apothegms only. See -n on which fortunes are considered
85           “short”.
86
87
88       -i
89
90           Ignore case for -m patterns.
91
92
93       -w
94
95           Wait before termination for an amount of time calculated from the
96           number of characters in the message. This is useful if it is
97           executed as part of the logout procedure to guarantee that the
98           message can be read before the screen is cleared.
99
100
101
102       The user may specify alternate sayings. You can specify a specific
103       file, a directory which contains one or more files, or the special word
104       all which says to use all the standard databases. Any of these may be
105       preceded by a percentage, which is a number n between 0 and 100
106       inclusive, followed by a %. If it is, there will be a n percent
107       probability that an adage will be picked from that file or directory.
108       If the percentages do not sum to 100, and there are specifications
109       without percentages, the remaining percent will apply to those files
110       and/or directories, in which case the probability of selecting from one
111       of them will be based on their relative sizes.
112
113
114       As an example, given two databases funny and not-funny, with funny
115       twice as big (in number of fortunes, not raw file size), saying
116
117
118       fortune funny not-funny
119
120
121       will get you fortunes out of funny two-thirds of the time. The command
122
123
124       fortune 90% funny 10% not-funny
125
126
127       will pick out 90% of its fortunes from funny (the “10% not-funny” is
128       unnecessary, since 10% is all that's left).
129
130
131       The -e option says to consider all files equal; thus
132
133
134       fortune -e funny not-funny
135
136
137       is equivalent to
138
139
140       fortune 50% funny 50% not-funny
141
142

FILES

144       Note: these are the defaults as defined at compile time.
145
146
147       /usr/share/games/fortune Directory for innoffensive fortunes.
148
149
150       If a particular set of fortunes is particularly unwanted, there is an
151       easy solution: delete the associated .dat file. This leaves the data
152       intact, should the file later be wanted, but since fortune no longer
153       finds the pointers file, it ignores the text file.
154
155

BUGS

157       The supplied fortune databases have been attacked, in order to correct
158       orthographical and grammatical errors, and particularly to reduce
159       redundancy and repetition and redundancy. But especially to avoid
160       repetitiousness. This has not been a complete success. In the process,
161       some fortunes may also have been lost.
162
163
164       The fortune databases are now divided into a larger number of smaller
165       files, some organized by format (poetry, definitions), and some by
166       content (religion, politics).
167
168

HISTORY

170       This version of fortune is based on the NetBSD fortune 1.4, but with a
171       number of bug fixes and enhancements.
172
173
174       The original fortune/strfile format used a single file; strfile read
175       the text file and converted it to null-delimited strings, which were
176       stored after the table of pointers in the .dat file. By NetBSD fortune
177       1.4, this had changed to two separate files: the .dat file was only the
178       header (the table of pointers, plus flags; see strfile.h), and the text
179       strings were left in their own file. The potential problem with this is
180       that text file and header file may get out of synch, but the advantage
181       is that the text files can be easily edited without resorting to unstr,
182       and there is a potential savings in disk space (on the assumption that
183       the sysadmin kept both .dat file with strings and the text file).
184
185
186       Many of the enhancements made over the NetBSD version assumed a Linux
187       system, and thus caused it to fail under other platforms, including
188       BSD. The source code has since been made more generic, and currently
189       works on SunOS 4.x as well as Linux, with support for more platforms
190       expected in the future. Note that some bugs were inadvertently
191       discovered and fixed during this process.
192
193
194       At a guess, a great many people have worked on this program, many
195       without leaving attributions.
196
197

SEE ALSO

199       re_comp(3), regcomp(3), strfile(1), unstr(1)
200
201
202
203
204BSD Experimental             19 April 94 [May. 97]                  FORTUNE(6)
Impressum