Package: pnu-fortune
Installationpip installpnu-fortuneFORTUNE(6)NAMEfortune — print a random, hopefully interesting, adageSYNOPSISfortune[-acCDefilosw]
[-m pattern]
[-n length]
[-t tries]
[--debug]
[--help|-?]
[--version]
[--]
[[N%] file/directory/all]DESCRIPTIONWhenfortuneis run with no arguments it prints out a random epigram from thefortunesdatabase.
Epigrams are divided into several categories, where each category is subdivided into those which are potentially offensive and those which are not.OPTIONSThe options are as follows:OptionUse-aChoose from all lists of maxims, both offensive and not (See the-ooption for more information on offensive fortunes).-cShow the cookie file from which the fortune came.-CCompatibility mode. Try to imitate the original BSD fortune command display as closely as possible.-DEnable additional debugging output. Specify this option multiple times for more verbose output (unused in this re-implementation).-eConsider all fortune files to be of equal size (see discussion below on multiple files).-fPrint out the list of files which would be searched, but do not print a fortune.-iIgnore case for-m patterns.-lLong dictums only. See-non how ''long'' is defined.-m patternPrint out all fortunes which match the regular expression pattern. See regex(3) for a description of patterns.-n lengthSet the longest fortune length (in characters) considered to be ''short'' (the default is 160). All fortunes longer than this are considered ''long''.-oChoose only from potentially offensive aphorisms. This option is superseded by-a.... let us keep in mind the basic governing philosophyof The Brotherhood, as handsomely summarized in these words:we believe in healthy, hearty laughter -- at the expense ofthe whole human race, if needs be.Needs be.--H. Allen Smith, "Rude Jokes"-sShort apophthegms only. See-non how ''short'' is defined.-t triesSet the maximum number of attempts while searching for a ''short'' or ''long'' fortune (the default is 10).-wWait 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.--debugEnable debug mode--help|-?Print usage and a short help message and exit--versionPrint version and exit--Options processing terminatorThe user may specify alternate sayings.
You can specify a specific file, a directory which contains one or more files, or the special wordallwhich 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 an 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, sayingfortune funny not-funnywill get you fortunes out of funny two-thirds of the time. The commandfortune 90% funny 10% not-funnywill pick out 90% of its fortunes from funny (the “10% not-funny” is unnecessary, since 10% is all that is left).
The-eoption says to consider all files equal; thusfortune -e funny not-funnyis equivalent tofortune 50% funny 50% not-funnyENVIRONMENTVariableUseFORTUNE_PATHThe search path for the data files. It is a colon-separated list of directories in which fortune looks for datafiles. If not set it will default to/usr/share/games/fortune:/usr/local/share/games/fortune.Under a Posix system,$HOME/.local/share/games/fortunewill also be added to the default, while%HOMEPATH%/appdata/roaming/python/share/games/fortune:%HOMEPATH%\appdata\local\programs\python\pythonXX\share\games\fortunewill be added under a Windows system.If none of the directories specified exist, it will print a warning and exit. Note that by default, fortune only searches for afortunesfile, instead of all files in its FORTUNE_PATH.FORTUNE_SAVESTATEIf set, fortune will save some state about what fortune it was up to on disk (unused in this re-implementation, as it requires root access to the fortune directories).FORTUNE_COMPATCompatibility mode. If set, try to imitate the original BSD fortune command display as closely as possible.FORTUNE_DEBUGDebug mode. If set, print some debug messages.FILESPathDescription/usr/share/games/fortune/*the fortunes databases (those files ending “-o” contain the offensive fortunes)/usr/local/share/games/fortune/*Additional fortunesWe offer many data files for this utility in several additional packages, a few of them already installed as a dependency to this one.EXIT STATUSThefortuneutility exits 0 on success, and >0 if an error occurs.
In particular, if-l,-m, or-sis specified, failure to find a matching citation in the selected files counts as an error.EXAMPLESBoxing the fortune output withechobox(1):/usr/local/bin/fortune unix-philosophy unix-quotes | echobox -S singleSEE ALSOcowsay(1),echobox(1),regex(3),strfile(8)STANDARDSThefortuneutility is a standard UNIX command, though not a part of POSIX.This version tries to follow thePEP 8style guide forPythoncode.PORTABILITYTested OK under Windows.HISTORYThefortuneutility first appeared in Version 7 AT&T UNIX.The much more sophisticated BSD version which this version re-implement was written by Ken Arnold around the end of 1978 and released with 4BSD and 4.1cBSD between 1980 and 1982.This re-implementation was made for thePNU project.It also has the-cand-noptions of the Linux version.
And it added-Cand-toptions of its own.LICENSEThis utility is available under the3-clause BSD license.AUTHORSHubert TournierThe man page is derived from theFreeBSD project's one.CAVEATSThere are some display differences with the-foption between this re-implementation and classical BSD or Linux versions.
For instance, probability percentages are printed for all files, not just those indicated.Another difference is that this re-implementation does not risk permanently searching for a short or long fortune in a data file which has none. It will make the specified number of attempts, then exit with an error code if nothing was found.