FORTUNE
Section: UNIX Reference Manual (6)
Updated: 19 April 94 [May. 97]
Index
Return to Main Contents
NAME
fortune - print a random, hopefully interesting, adage
SYNOPSIS
fortune [-aefilosw] [-n
length] [
-m
pattern] [[n%] file/dir/all]
DESCRIPTION
When
fortune
is run with no arguments it prints out a random epigram. Epigrams are
divided into several categories, where each category is sub-divided
into those which are potentially offensive and those which are not.
Options
The options are as follows:
- -a
-
Choose from all lists of maxims, both offensive and not. (See the
-o
option for more information on offensive fortunes.)
- -e
-
Consider all fortune files to be of equal size (see discussion below
on multiple files).
- -f
-
Print out the list of files which would be searched, but don't
print a fortune.
- -l
-
Long dictums only. See
-n
on how ``long'' is defined in this sense.
- -m pattern
-
Print out all fortunes which match the basic regular expression
pattern.
The syntax of these expressions depends on how your system defines
re_comp(3) or regcomp(3),
but it should nevertheless be similar to the syntax used in
grep(1).
-
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
also
redirected to this file, the result is
still valid,
but there will be ``bogus''
fortunes,
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.
- -n length
-
Set the longest fortune length (in characters) considered to be
``short'' (the default is 160). All fortunes longer than this are
considered ``long''. 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.
- -o
-
Choose only from potentially offensive aphorisms.
Please, please, please request a potentially
offensive fortune if and only if
you believe, deep in your heart,
that you are willing to be
offended. (And that you'll just quit
using -o rather
than give us grief about it,
okay?)
-
... let us keep in mind the basic governing philosophy of The
Brotherhood, as handsomely summarized in these words: we believe in
healthy, hearty laughter -- at the expense of the whole human race, if
needs be. Needs be.
-
--H. Allen Smith, "Rude Jokes"
- -s
-
Short apothegms only. See
-n
on which fortunes are considered ``short''.
- -i
-
Ignore case for
-m
patterns.
- -w
-
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.
The user may specify alternate sayings. You can specify a specific
file, a directory which contains one or more files, or the special word
all
which says to use all the standard databases. Any of these may be
preceded by a percentage, which is a number
n
between 0 and 100 inclusive, followed by a
%.
If it is, there will be a
n
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.
As an example, given two databases
funny and not-funny, with funny
twice as big (in number of fortunes, not raw file size), saying
-
fortune
funny not-funny
will get you fortunes out of
funny
two-thirds of the time. The command
-
fortune
90% funny 10% not-funny
will pick out 90% of its fortunes from
funny
(the ``10% not-funny'' is unnecessary, since 10% is all that's left).
The
-e
option says to consider all files equal; thus
-
fortune -e
funny not-funny
is equivalent to
-
fortune
50% funny 50% not-funny
This fortune also supports the BSD method of appending ``-o'' to
database names to specify offensive fortunes. However this is
not
how fortune stores them: offensive fortunes are stored in a seperate
directory without the ``-o'' infix. A plain name (i.e., not a path to a
file or directory) that ends in ``-o'' will be assumed to be an
offensive database, and will have its suffix stripped off and be
searched in the offensive directory (even if the neither of the
-a or -o
options were specified). This feature is not only for
backwards-compatibility, but also to allow users to distinguish between
inoffensive and offensive databases of the same name.
For example, assuming there is a database named
definitions
in both the inoffensive and potentially offensive collections, then the
following command will select an inoffensive definition 90% of the time,
and a potentially offensive definition for the remaining 10%:
-
fortune
90%
definitions definitions-o
FILES
Note: these are the defaults as defined at compile time.
-
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- Options
-
- FILES
-
This document was created by
man2html,
using the manual pages.
Time: 06:12:11 GMT, April 11, 2025