同一命令的手册页是否因来源不同而不同?

同一命令的手册页是否因来源不同而不同?

对于措辞不当的问题,我深表歉意,但当我查看-i中的开关时man sed,我看到:

   -i[SUFFIX], --in-place[=SUFFIX]

          edit files in place (makes backup if SUFFIX supplied)

就这样。

但后来我发现关于 sed 的就地编辑选项的简要说明有更长的解释sed -i 来自手册页:

From the sed manpage:

-i extension
   Edit files in-place, saving backups with the specified extension.
   If a zero-length extension is given, no backup will be saved.  It
   is not recommended to give a zero-length extension when in-place
   editing files, as you risk corruption or partial content in situ-
   ations where disk space is exhausted, etc.

那么哪里可以找到更详细的手册页?有人知道更详细版本的来源吗?

答案1

你所发现的可能是Mac OS X 系统上 sed 实用程序的手册页这与您在 Ubuntu 上使用的 sed 实用程序不同。据我所知,虽然 Mac OS X 上的 sed 实用程序源自 BSD Unix,但 Ubuntu 上的 sed 实用程序是由 GNU 项目编写的。

如果您需要有关更详细的文档,GNU utility那么值得打开其info文档而不是其手册页。在 GNU 项目中,手册页是次要的。例如,看看您可以-i在 sedinfo页面中找到有关该选项的信息:

`-i[SUFFIX]'
`--in-place[=SUFFIX]'

   This option specifies that files are to be edited in-place.  GNU
   `sed' does this by creating a temporary file and sending output to
   this file rather than to the standard output.(1).

   This option implies `-s'.

   When the end of the file is reached, the temporary file is renamed
   to the output file's original name.  The extension, if supplied,
   is used to modify the name of the old file before renaming the
   temporary file, thereby making a backup copy(2)).

   This rule is followed: if the extension doesn't contain a `*',
   then it is appended to the end of the current filename as a
   suffix; if the extension does contain one or more `*' characters,
   then _each_ asterisk is replaced with the current filename.  This
   allows you to add a prefix to the backup file, instead of (or in
   addition to) a suffix, or even to place backup copies of the
   original files into another directory (provided the directory
   already exists).

   If no extension is supplied, the original file is overwritten
   without making a backup.

答案2

根据您安装程序的来源,会有不同的版本,有时维护人员会在较新的版本上更新应用程序的手册。我认为最准确的版本始终是您安装的版本,因为您的系统中的手册与该版本完全相同。如果您在线搜索帮助,参数可能已过时(或太新)。但有时在线手册更好,因为您可能会找到更详尽的解释,甚至有关如何使用参数、标志等的示例。

相关内容