Debian Codegraph @

upstream/fedora-44/man6/fortune.6

raw
1 '\" t
2 .\" Title: FORTUNE
3 .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\" Date: 19 April 94 [May. 97]
6 .\" Manual: UNIX Reference Manual
7 .\" Source: BSD Experimental
8 .\" Language: English
9 .\"
10 .TH "FORTUNE" "6" "19 April 94 [May\&. 97]" "BSD Experimental" "UNIX Reference Manual"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30
31 .SH "NAME"
32 fortune \- print a random, hopefully interesting, adage
33
34 .SH "SYNOPSIS"
35 .HP \w'\fBfortune\fR\ 'u
36
37 \fBfortune\fR [\-acefilosw]
38 [\-n\ \fIlength\fR]
39 [\-m\ \fIpattern\fR]
40 [[\fIn%\fR]\ \fIfile/dir/all\fR]
41
42 .SH "DESCRIPTION"
43 .PP
44 When
45 \fBfortune\fR
46 is run with no arguments it prints out a random epigram\&. Epigrams are divided into several categories\&.
47
48 .SS "Options"
49 .PP
50 The options are as follows:
51
52 .PP
53 \fB\-a\fR
54 .RS 4
55
56 Choose from all lists of maxims\&.
57
58 .RE
59 .PP
60 \fB\-c\fR
61 .RS 4
62
63 Show the cookie file from which the fortune came\&.
64
65 .RE
66 .PP
67 \fB\-e\fR
68 .RS 4
69
70 Consider all fortune files to be of equal size (see discussion below on multiple files)\&.
71
72 .RE
73 .PP
74 \fB\-f\fR
75 .RS 4
76
77 Print out the list of files which would be searched, but don\*(Aqt print a fortune\&.
78
79 .RE
80 .PP
81 \fB\-l\fR
82 .RS 4
83
84 Long dictums only\&. See
85 \fB\-n\fR
86 on how \(lqlong\(rq is defined in this sense\&.
87
88 .RE
89 .PP
90 \fB\-m \fR\fIpattern\fR
91 .RS 4
92
93 Print out all fortunes which match the basic regular expression
94 \fIpattern\fR\&. The syntax of these expressions depends on how your system defines
95 \fBre_comp\fR(3)
96 or
97 \fBregcomp\fR(3), but it should nevertheless be similar to the syntax used in
98 \fBgrep\fR(1)\&.
99
100 The fortunes are output to standard output, while the names of the file from which each fortune comes are printed to standard error\&. Either or both can be redirected; if standard output is redirected to a file, the result is a valid fortunes database file\&. If standard error is
101 \fIalso\fR
102 redirected to this file, the result is
103 \fIstill valid\fR,
104 \fBbut there will be \(lqbogus\(rq\fR
105 \fBfortunes\fR, i\&.e\&. the filenames themselves, in parentheses\&. This can be useful if you wish to remove the gathered matches from their original files, since each filename\-record will precede the records from the file it names\&.
106
107 .RE
108 .PP
109 \fB\-n \fR\fIlength\fR
110 .RS 4
111
112 Set the longest fortune length (in characters) considered to be \(lqshort\(rq (the default is 160)\&. All fortunes longer than this are considered \(lqlong\(rq\&. Be careful! If you set the length too short and ask for short fortunes, or too long and ask for long ones, fortune goes into a never\-ending thrash loop\&.
113
114 .RE
115
116 .PP
117 \fB\-s\fR
118 .RS 4
119
120 Short apothegms only\&. See
121 \fB\-n\fR
122 on which fortunes are considered \(lqshort\(rq\&.
123
124 .RE
125 .PP
126 \fB\-i\fR
127 .RS 4
128
129 Ignore case for
130 \fB\-m\fR
131 patterns\&.
132
133 .RE
134 .PP
135 \fB\-w\fR
136 .RS 4
137
138 Wait before termination for an amount of time calculated from the number of characters in the message\&. This is useful if it is executed as part of the logout procedure to guarantee that the message can be read before the screen is cleared\&.
139
140 .RE
141
142 .PP
143 The user may specify alternate sayings\&. You can specify a specific file, a directory which contains one or more files, or the special word
144 \fIall\fR
145 which says to use all the standard databases\&. Any of these may be preceded by a percentage, which is a number
146 \fIn\fR
147 between 0 and 100 inclusive, followed by a
148 \fI%\fR\&. If it is, there will be a
149 \fIn\fR
150 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\&.
151
152 .PP
153 As an example, given two databases
154 \fIfunny\fR
155 and
156 \fInot\-funny\fR, with
157 \fIfunny\fR
158 twice as big (in number of fortunes, not raw file size), saying
159
160 .PP
161 \fBfortune\fR
162 \fIfunny not\-funny\fR
163
164 .PP
165 will get you fortunes out of
166 \fIfunny\fR
167 two\-thirds of the time\&. The command
168
169 .PP
170 \fBfortune\fR
171 90%
172 \fIfunny\fR
173 10%
174 \fInot\-funny\fR
175
176 .PP
177 will pick out 90% of its fortunes from
178 \fIfunny\fR
179 (the \(lq10% not\-funny\(rq is unnecessary, since 10% is all that\*(Aqs left)\&.
180
181 .PP
182 The
183 \fB\-e\fR
184 option says to consider all files equal; thus
185
186 .PP
187 \fBfortune \-e\fR
188 \fIfunny not\-funny\fR
189
190 .PP
191 is equivalent to
192
193 .PP
194 \fBfortune\fR
195 50%
196 \fIfunny\fR
197 50%
198 \fInot\-funny\fR
199
200 .SH "FILES"
201 .PP
202 Note: these are the defaults as defined at compile time\&.
203
204 .PP
205 \fI/usr/share/games/fortune\fR
206 Directory for innoffensive fortunes\&.
207
208 .PP
209 If a particular set of fortunes is particularly unwanted, there is an easy solution: delete the associated
210 \fB\&.dat\fR
211 file\&. This leaves the data intact, should the file later be wanted, but since
212 \fBfortune\fR
213 no longer finds the pointers file, it ignores the text file\&.
214
215 .SH "BUGS"
216 .PP
217 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 repetitiousness\&. This has not been a complete success\&. In the process, some fortunes may also have been lost\&.
218
219 .PP
220 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)\&.
221
222 .SH "HISTORY"
223 .PP
224 This version of fortune is based on the NetBSD fortune 1\&.4, but with a number of bug fixes and enhancements\&.
225
226 .PP
227 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
228 \fIstrfile\&.h\fR), 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)\&.
229
230 .PP
231 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 inadvertently discovered and fixed during this process\&.
232
233 .PP
234 At a guess, a great many people have worked on this program, many without leaving attributions\&.
235
236 .SH "SEE ALSO"
237 .PP
238 \fBre_comp\fR(3),
239 \fBregcomp\fR(3),
240 \fBstrfile\fR(1),
241 \fBunstr\fR(1)
242