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

NAME

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

SYNOPSIS

9       fortune [-acefilsw] [-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.
14
15   Options
16       The options are as follows:
17
18       -a     Choose from all lists of maxims.
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       -s     Short  apothegms  only.  See -n on which fortunes are considered
56              ``short''.
57
58       -i     Ignore case for -m patterns.
59
60       -w     Wait before termination for an amount of  time  calculated  from
61              the  number  of characters in the message.  This is useful if it
62              is executed as part of the logout procedure  to  guarantee  that
63              the message can be read before the screen is cleared.
64
65       The  user  may  specify  alternate sayings.  You can specify a specific
66       file, a directory which contains one or more files, or the special word
67       all  which says to use all the standard databases.  Any of these may be
68       preceded by a percentage, which is a number n between 0 and 100  inclu‐
69       sive, followed by a %.  If it is, there will be a n percent probability
70       that an adage will be picked from that file or directory. If  the  per‐
71       centages  do  not sum to 100, and there are specifications without per‐
72       centages, the remaining percent will apply to those files and/or direc‐
73       tories,  in  which  case  the probability of selecting from one of them
74       will be based on their relative sizes.
75
76       As an example, given two databases  funny  and  not-funny,  with  funny
77       twice as big (in number of fortunes, not raw file size), saying
78
79              fortune funny not-funny
80
81       will get you fortunes out of funny two-thirds of the time.  The command
82
83              fortune 90% funny 10% not-funny
84
85       will  pick out 90% of its fortunes from funny (the ``10% not-funny'' is
86       unnecessary, since 10% is all that's left).
87
88       The -e option says to consider all files equal; thus
89
90              fortune -e funny not-funny
91
92       is equivalent to
93
94              fortune 50% funny 50% not-funny
95
96

FILES

98       Note: these are the defaults as defined at compile time.
99
100       /usr/share/games/fortune
101              Directory for fortunes.
102
103       If a particular set of fortunes is particularly unwanted, there  is  an
104       easy  solution:  delete the associated .dat file.  This leaves the data
105       intact, should the file later be wanted, but since  fortune  no  longer
106       finds the pointers file, it ignores the text file.
107

BUGS

109       The  supplied fortune databases have been attacked, in order to correct
110       orthographical and  grammatical  errors,  and  particularly  to  reduce
111       redundancy and repetition and redundancy.  But especially to avoid rep‐
112       etitiousness.  This has not been a complete success.  In  the  process,
113       some fortunes may also have been lost.
114
115       The  fortune  databases are now divided into a larger number of smaller
116       files, some organized by format (poetry, definitions), and some by con‐
117       tent (religion, politics).
118

HISTORY

120       This  version of fortune is based on the NetBSD fortune 1.4, but with a
121       number of bug fixes and enhancements.
122
123       The original fortune/strfile format used a single  file;  strfile  read
124       the  text  file  and converted it to null-delimited strings, which were
125       stored after the table of pointers in the .dat file.  By NetBSD fortune
126       1.4, this had changed to two separate files: the .dat file was only the
127       header (the table of pointers, plus flags; see strfile.h), and the text
128       strings  were  left in their own file.  The potential problem with this
129       is that text file and header file may get out of synch, but the  advan‐
130       tage  is  that the text files can be easily edited without resorting to
131       unstr, and there is a potential savings in disk space (on  the  assump‐
132       tion  that  the  sysadmin kept both .dat file with strings and the text
133       file).
134
135       Many of the enhancements made over the NetBSD version assumed  a  Linux
136       system,  and  thus  caused  it to fail under other platforms, including
137       BSD.  The source code has since been made more generic,  and  currently
138       works  on  SunOS  4.x as well as Linux, with support for more platforms
139       expected in the future.  Note that some bugs were inadvertently discov‐
140       ered and fixed during this process.
141
142       At a guess, a great many people have worked on this program, many with‐
143       out leaving attributions.
144

SEE ALSO

146       re_comp(3), regcomp(3), strfile(1), unstr(1)
147
148
149
150BSD Experimental             19 April 94 [May. 97]                  FORTUNE(6)
Impressum