Chinaunix首页 | 论坛 | 博客
  • 博客访问: 713321
  • 博文数量: 759
  • 博客积分: 7000
  • 博客等级: 少将
  • 技术积分: 4775
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-22 15:16
文章分类

全部博文(759)

文章存档

2008年(759)

我的朋友

分类:

2008-09-25 15:48:49

fortune is a simple program that displays a random message from a database of quotations. Most distributions of fortune are bundled with files of quotations from famous people, sayings like those found on fortune cookies (hence the name), and other humorous items. fortune is predominantly found on Unix-like systems, but clients for other platforms exist as well. Often, users on text-mode Unix terminals will place this command into either their .profile or .logout files to display them at logon and logout, respectively.

Most Unix systems use a roughly equivalent set of fortunes. The fortunes dispensed are slanted heavily toward the user base of Unix, and thus contain many obscure jokes about computer science and computer programming. Other favoured sources include quotations from science fiction (Star Trek, The Cyberiad, Doctor Who, The Hitchhiker's Guide to the Galaxy, etc.), and the writings of Ambrose Bierce and Dave Barry. Most fortune collections also include a wide variety of more conventionally-sourced quotations, jokes, and other short passages. A few distributions include so-called "offensive" dicta, which require the -a or -o options to be passed for viewing (see the section "Common options" below).

One of the included fortunes, from the "goedel" collection of fortunes about fortune itself, sums up the purpose of the program:
引用:
Has anyone realized that the purpose of the fortune cookie program is to
defuse project tensions?  When did you ever see a cheerful cookie, a
non-cynical, or even an informative cookie?
        Perhaps inadvertently, we have a channel for our aggressions.  This
still begs the question of whether the cookie releases the pressure or only
serves to blunt the warning signs.

        Long live the revolution!
        Have a nice day.
Conventional versions of fortune use two files for each quotation list: a text file with quotations, each separated by the character "%" on its own line, and a random-access data file generated by the strfile(8) program. Alternative implementations, including those made for display on Web pages, typically use only the text file.

A fortune program first appeared in Version 7 Unix. The most common version on modern systems is the BSD fortune, originally written by Ken Arnold.      
--------------------next---------------------

阅读(342) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~