Skip to main content

# Introduction

fortune is a stripped-down implementation of the classic BSD Unix fortune command. It combines the capabilities of the strfile command (which produces the fortune index file) and the fortune command (which displays a random fortune). It reads the traditional fortune program’s text file format.

# Usage

Usage:

fortune [OPTIONS] /path/to/fortunes

OPTIONS

-h, --help

Show usage and exit.

-u, --update

Update the index file.

-q, --quiet

When updating the index file, do so quietly.

-V, --version

Show version and exit.

If you omit the path, fortune looks at the FORTUNE_FILE environment variable. If that environment variable isn’t set, fortune aborts.

# Fortune Cookie File Format

A fortune cookie file is a text file full of quotes. The format is simple: The file consists of paragraphs separated by lines containing a single ‘%’ character. For example:

A little caution outflanks a large cavalry.
    -- Bismarck
%
A little retrospection shows that although many fine, useful software
systems have been designed by committees and built as part of multipart
projects, those software systems that have excited passionate fans are
those that are the products of one or a few designing minds, great
designers. Consider Unix, APL, Pascal, Modula, the Smalltalk interface,
even Fortran; and contrast them with Cobol, PL/I, Algol, MVS/370, and
MS-DOS.
    -- Fred Brooks, Jr.
%
A man is not old until regrets take the place of dreams.
    -- John Barrymore

# Generating a Random Fortune

Just run:

fortune /path/to/fortunes

If your FORTUNE_FILE environment variable is set, you can run it as

fortune

# Differences

This version of fortune does not provide some of the more advanced capabilities of the original BSD program. For instance, it lacks:

  • the ability to mark offensive and inoffensive fortunes

  • the ability to separate long and short quotes

  • the ability to print all fortunes matching a regular expression

It does, however, provide the most important function: The ability to display a random quote from a set of quotes.

Metadata

Release files for fortune 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fortune 1.1.1
File Size Uploaded Provenance
fortune-1.1.1.tar.gz 8.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fortune 1.1.1
File Interpreter ABI Platform
fortune-1.1.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 17.5 kB

Release files / fortune-1.1.1.tar.gz

Download URL fortune-1.1.1.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7c59a7442f6b1e0e7abe5d524fc23ede8c60478967d95b629bcde38ba7773e1c
BLAKE2b-256 checksum
How to use checksums
5fcba634b313615961012775d8b4ab03e0bac853396c976c3e77ded8e0404af4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / fortune-1.1.1-py2.py3-none-any.whl

Download URL fortune-1.1.1-py2.py3-none-any.whl
Size 9.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
67cf3dae7bc9685af98dfb4476878018598664e65ffe1aad0d359ec0dc92d058
BLAKE2b-256 checksum
How to use checksums
ad489e4b4bba762eb059601fbfece3cc0cfef87d2688d1dddb91d0c361ad682f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for fortune 1.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files No provenance

1.0.1

0.5.2

0.5

0.4

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page