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

NAME

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

SYNOPSIS

9       fortune [-acefilosw] [-n length] [ -m pattern] [[n%] file/dir/all]
10

DESCRIPTION

12       When  fortune  is run with no arguments it prints out a random epigram.
13       Epigrams are divided into several categories, where  each  category  is
14       sub-divided  into those which are potentially offensive and those which
15       are not..SS Options The options are as follows:
16
17       -a     Choose from all lists of maxims, both offensive and  not.   (See
18              the -o option for more information on offensive fortunes.)
19
20       -c     Show the cookie file from which the fortune came.
21
22       -e     Consider  all  fortune files to be of equal size (see discussion
23              below on multiple files).
24
25       -f     Print out the list of files which would be searched,  but  don't
26              print a fortune.
27
28       -l     Long  dictums  only.   See -n on how ``long'' is defined in this
29              sense.
30
31       -m pattern
32              Print out all fortunes which match the basic regular  expression
33              pattern.   The  syntax  of these expressions depends on how your
34              system defines re_comp(3) or regcomp(3), but it should neverthe‐
35              less be similar to the syntax used in grep(1).
36
37              The  fortunes  are output to standard output, while the names of
38              the file from which each fortune comes are printed  to  standard
39              error.   Either or both can be redirected; if standard output is
40              redirected to a file, the result is a  valid  fortunes  database
41              file.   If  standard  error is also redirected to this file, the
42              result is still valid, but there  will  be  ``bogus''  fortunes,
43              i.e. the filenames themselves, in parentheses.  This can be use‐
44              ful if you wish to remove the gathered matches from their origi‐
45              nal  files,  since each filename-record will precede the records
46              from the file it names.
47
48       -n length
49              Set the longest fortune length (in characters) considered to  be
50              ``short''  (the  default is 160).  All fortunes longer than this
51              are considered ``long''.  Be careful!  If you set the length too
52              short  and  ask for short fortunes, or too long and ask for long
53              ones, fortune goes into a never-ending thrash loop.
54
55       -o     Choose only from potentially offensive aphorisms.  The -o option
56              is ignored if a fortune directory is specified.
57
58              Please,  please,  please request a potentially offensive fortune
59              if and only if you believe, deep in your  heart,  that  you  are
60              willing  to  be  offended.  (And  that you'll just quit using -o
61              rather than give us grief about it, okay?)
62
63              ... let us keep in mind the basic governing  philosophy  of  The
64              Brotherhood, as handsomely summarized in these words: we believe
65              in healthy, hearty laughter -- at the expense of the whole human
66              race, if needs be.  Needs be.
67                     --H. Allen Smith, "Rude Jokes"
68
69       -s     Short  apothegms  only.  See -n on which fortunes are considered
70              ``short''.
71
72       -i     Ignore case for -m patterns.
73
74       -w     Wait before termination for an amount of  time  calculated  from
75              the  number  of characters in the message.  This is useful if it
76              is executed as part of the logout procedure  to  guarantee  that
77              the message can be read before the screen is cleared.
78
79       The  user  may  specify  alternate sayings.  You can specify a specific
80       file, a directory which contains one or more files, or the special word
81       all  which says to use all the standard databases.  Any of these may be
82       preceded by a percentage, which is a number n between 0 and 100  inclu‐
83       sive, followed by a %.  If it is, there will be a n percent probability
84       that an adage will be picked from that file or directory. If  the  per‐
85       centages  do  not sum to 100, and there are specifications without per‐
86       centages, the remaining percent will apply to those files and/or direc‐
87       tories,  in  which  case  the probability of selecting from one of them
88       will be based on their relative sizes.
89
90       As an example, given two databases  funny  and  not-funny,  with  funny
91       twice as big (in number of fortunes, not raw file size), saying
92
93              fortune funny not-funny
94
95       will get you fortunes out of funny two-thirds of the time.  The command
96
97              fortune 90% funny 10% not-funny
98
99       will  pick out 90% of its fortunes from funny (the ``10% not-funny'' is
100       unnecessary, since 10% is all that's left).
101
102       The -e option says to consider all files equal; thus
103
104              fortune -e funny not-funny
105
106       is equivalent to
107
108              fortune 50% funny 50% not-funny
109
110       This fortune also supports the BSD method of appending ``-o'' to  data‐
111       base names to specify offensive fortunes.  However this is not how for‐
112       tune stores them: offensive fortunes are stored in a separate directory
113       without  the ``-o'' infix.  A plain name (i.e., not a path to a file or
114       directory) that ends in ``-o'' will be assumed to be an offensive data‐
115       base,  and  will  have  its  suffix stripped off and be searched in the
116       offensive directory (even if the neither of the -a or -o  options  were
117       specified).   This feature is not only for backwards-compatibility, but
118       also to allow users to distinguish between  inoffensive  and  offensive
119       databases of the same name.
120
121       For example, assuming there is a database named definitions in both the
122       inoffensive and potentially offensive collections, then  the  following
123       command  will  select  an inoffensive definition 90% of the time, and a
124       potentially offensive definition for the remaining 10%:
125
126              fortune 90% definitions definitions-o
127

FILES

129       Note: these are the defaults as defined at compile time.
130
131       /home/shlomif/apps/to-del-fortune/share/games/fortunes
132              Directory for innoffensive fortunes.
133       /home/shlomif/apps/to-del-fortune/share/games/fortunes/off
134              Directory for offensive fortunes.
135
136       If a particular set of fortunes is particularly unwanted, there  is  an
137       easy  solution:  delete the associated .dat file.  This leaves the data
138       intact, should the file later be wanted, but since  fortune  no  longer
139       finds the pointers file, it ignores the text file.
140

BUGS

142       The division of fortunes into offensive and non-offensive by directory,
143       rather than via the `-o' file infix, is not 100% compatible with origi‐
144       nal  BSD fortune. Although the `-o' infix is recognised as referring to
145       an offensive database, the offensive database files still need to be in
146       a  separate  directory.  The workaround, of course, is to move the `-o'
147       files into the offensive directory (with or without renaming),  and  to
148       use the -a option.
149
150       The  supplied fortune databases have been attacked, in order to correct
151       orthographical and  grammatical  errors,  and  particularly  to  reduce
152       redundancy and repetition and redundancy.  But especially to avoid rep‐
153       etitiousness.  This has not been a complete success.  In  the  process,
154       some fortunes may also have been lost.
155
156       The  fortune  databases are now divided into a larger number of smaller
157       files, some organized by format (poetry, definitions), and some by con‐
158       tent (religion, politics).  There are parallel files in the main direc‐
159       tory and in the offensive files directory  (e.g.,  fortunes/definitions
160       and  fortunes/off/definitions).  Not all the potentially offensive for‐
161       tunes are in the offensive fortunes files, nor are all the fortunes  in
162       the  offensive  files  potentially offensive, probably, though a strong
163       attempt has been made to achieve greater consistency.  Also,  a  better
164       division might be made.
165

HISTORY

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

SEE ALSO

193       re_comp(3), regcomp(3), strfile(1), unstr(1)
194
195
196
197BSD Experimental             19 April 94 [May. 97]                  FORTUNE(6)
Impressum