无法将所有 GNU Unix 手册与 Mac 中的所有 Unix 手册进行比较

发布于 2024-07-15 09:39:24 字数 518 浏览 9 评论 0原文

我想通过 sdiff 比较所有 GNU Unix 手册和 Mac 的 Unix 手册。

例如,我不知道你如何浏览所有 Mac 的 Unix 手册,然后将它们保存到文件中。

当手册在两个文件中时,可以通过以下代码进行比较

sdiff <(file1) <(file2)

也许,有一些 Unix 命令名称的索引,这样我们就可以执行以下操作

sdiff <(man *[in the index]) <(man *[in the index])

如何将所有 GNU Unix 手册与 Mac 中的所有 Unix 手册进行比较?

[编辑]

Mac 的手册位于 /usr/share/man/man[1-9]/*。 当我尝试捕捉它们时,我遇到了编码问题。

另一个问题是找到Coreutils手册的位置。

I would like to compare all GNU Unix manuals and and Mac's Unix manuals by sdiff.

I do not know how you go through, for instance, all Mac's Unix manuals and then save them to a file.

The comparison can be done by the following code when the manuals are in two files

sdiff <(file1) <(file2)

Perhaps, there is some index of Unix command names such that we can do the following

sdiff <(man *[in the index]) <(man *[in the index])

How can you compare all GNU Unix manuals with all Unix manuals in Mac?

[edit]

Mac's manuals are at /usr/share/man/man[1-9]/*.
I have an encoding problem with them when I try to cat them.

Another problem is to find the location of Coreutils' manuals.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

奈何桥上唱咆哮 2024-07-22 09:39:24

您的目标是确定各种程序的不同 BSD 与 GNU/Linux 版本的不同参数,这将有些乏味。 值得注意的是,所有命令还有其他变体。 有系统 V 版本、BSD 版本和 GNU 版本,Mac 则混合使用这三种版本。无论如何,作为起点,文件本身都充满了您不感兴趣的格式化宏。 man 通过 'col -b' 的输出来获取可以比较的数据。 在生成命令列表方面,您只需 ls -1 /bin /usr/bin' 然后类似这样的事情就可以了:

while read command ; do
    man $command | col -b > output1
    man ./path/to/GNU/$command | col -b > output2
    diff  output1 output2  |  grep  '^[ ]*-' > $command.diffs
 done<<EOF
 diff
 grep
 sort
 ...
 ...
 EOF

Your goal, to identify the differing parameters for the different BSD vs GNU/Linux versions of the various programs, is going to be somewhat tedious. It's useful to note that there are other variants of all commands as well. There are system V versions and BSD versions and GNU versions, and the Mac uses a mish-mash of all 3. In any event, as a starting point, the files themselves are filled with formatting macros that you have no interest in. Pipe the output of man through 'col -b' to get data you can diff. In terms of generating the list of commands, you could just ls -1 /bin /usr/bin' Then something like this would get you most of the way:

while read command ; do
    man $command | col -b > output1
    man ./path/to/GNU/$command | col -b > output2
    diff  output1 output2  |  grep  '^[ ]*-' > $command.diffs
 done<<EOF
 diff
 grep
 sort
 ...
 ...
 EOF
难理解 2024-07-22 09:39:24

GNU 的意思是 (G)NU 是 (N)ot (U)nix。 GNU 无论如何都不是基于 UNIX 的,这不可能是由于版权和许可问题。

大多数 GNU 文档都是以 texinfo 格式编写的(Debian 后来根据用户需要的手册页将其转换为 roff (man) 格式)。 该文档绝不是基于 BSD 文档,GNU 中的所有内容都是从头开始编写的。

试图区分两者就像区分字典和同义词库。 你会发现它们都包含许多相同的单词,但却是完全不同的书,由完全不同的人写的。

该文档根本没有充分解释 GNU 和 BSD(以及扩展的 MacOS)之间的差异。

GNU means (G)NU is (N)ot (U)nix. GNU is not based, in any way on UNIX, it could not be due to copyright and licensing issues.

Most GNU documentation was written in texinfo format (which Debian later converted to roff (man) format as users wanted man pages). The documentation is in no way based upon the BSD documentation, everything in GNU was written from scratch.

Trying to diff between the two is like diffing a dictionary against a thesaurus. You will find that they both contain many of the same words, but are entirely different books written by entirely different people.

The documentation in no way adequately explains the differences between GNU and BSD (and by extension MacOS).

假装不在乎 2024-07-22 09:39:24

所有手册页都存在于 /usr/share/man/* 中; 我不确定你想在这里完成什么。 Mac 在 BSD 上运行,因此大多数应用程序与您在 BSD 计算机上找到的应用程序相同。 如果您仍然想这样做,则需要获取 *nix 中与 Mac 中相同的应用程序以及相同版本的手册页(因为手册页可能会更改)。 是的,我想说的是,对 linux 盒子中的所有手册页进行 diff /usr/share/man/man[0-9]/* 和扩展 tar。

All man pages exist within the /usr/share/man/*; I'm not sure what you are attempting to accomplish here. Mac runs on BSD, so most applications are going to be the same as the ones you would find on the BSD machine. If you still wanted to do it, you would need to grab the manual pages of the same applications in *nix as in Mac as well as the same version (since the man page can change). And yea, I would say that doing a diff /usr/share/man/man[0-9]/* and the expanded tar of all the man pages from the linux box.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文