python版本的旧bsd unix fortune程序,python3已修补
sv-fortune的Python项目详细描述
简介
fortune是经典bsd unix的精简实现 fortune命令。它结合了strfile命令的功能 (它生成财富索引文件)和fortune命令(它 显示随机财富)。它读取传统的fortune程序的 文本文件格式。
用法
用法:
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.
如果省略路径,fortune将查看FORTUNE_FILE环境 变量。如果未设置该环境变量,fortune将中止。
索引文件
为了提高效率和速度,fortune使用索引文件存储偏移量 以及财富文本文件中每个财富的长度。所以,在你使用之前 fortune要读取随机财富,必须生成数据文件。与 在传统的bsd fortune程序中,您使用了i{strfile}(8)命令 生成索引。然而,有了i{this}fortune程序,您只需 将特殊参数传递给fortune命令:
fortune -u /path/to/fortunes
该命令将生成一个二进制/path/to/fortunes.dat文件 包含索引。无论何时更改文本,都应该运行fortune -u。 财富档案。
产生随机财富
一旦你有了一个索引文件,你就可以通过 使用文本财富文件的路径运行fortune实用程序:
fortune /path/to/fortunes
差异
此版本的fortune不提供一些更高级的 原始bsd程序的功能。例如,它缺少:
- 能够标记进攻性和非进攻性财富
- 区分长引号和短引号的能力
- 能够打印与正则表达式匹配的所有财富
不过,它确实提供了最重要的功能:显示 一组引号中的随机引号。
许可证和版权信息
版权所有(c)2008 Brian M.Clapper
这是一款免费软件,根据以下类似BSD的许可证发布:
以源和二进制形式重新分配和使用,有无 如果满足以下条件,则允许修改:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
The end-user documentation included with the redistribution, if any, must include the following acknowlegement:
This product includes software developed by Brian M. Clapper (bmc@clapper.org, http://www.clapper.org/bmc/). That software is copyright (c) 2008 Brian M. Clapper.
Alternately, this acknowlegement may appear in the software itself, if and wherever such third-party acknowlegements normally appear.
本软件按原样提供,并提供任何明示或暗示的保证, 包括但不限于适销性和 特定目的的健身被拒绝了。在任何情况下,布赖恩M。 克拉珀对任何直接的、间接的、附带的、特殊的、惩戒性的或 间接损害(包括但不限于 替代品或服务;使用、数据或利润损失;或业务 无论是何种原因造成的,根据任何责任理论,无论 合同、严格责任或侵权行为(包括疏忽或其他) 以任何方式使用本软件,即使已通知 可能造成这种损害。