gpt4 book ai didi

linux - 如何让 `MANPATH=~/.nmap/doc man 1 nmap` 寻找 nmap.1?

转载 作者:太空宇宙 更新时间:2023-11-04 10:51:54 24 4
gpt4 key购买 nike

我最近决定,因为我经常试验最新版本的 nmap,所以将其 SVN check out 保存在 ~/.nmap 中可能是个好主意安装并运行 svn up; make 使其保持最新状态。我将 ~/.nmap 添加到 $PATH 并意识到使用此设置,我无法再运行 man nmap。我阅读了 $MANPATH 并意识到这似乎对我不起作用:

[14:51:28][~/.nmap]$ manpath                                          
manpath: warning: $MANPATH set, prepending /etc/man_db.conf
/home/d/virtualenv/share/man:/usr/local/man:/usr/local/share/man:/usr/share/man:/usr/man:/home/d/.nmap/docs/man-xlate/:/home/d/.nmap/docs
[14:51:32][~/.nmap]$ strace man 1 nmap 2>&1 | egrep 'nmap.1|write'
stat("/home/d/.nmap/docs/zenmap.1", {st_mode=S_IFREG|0664, st_size=5943, ...}) = 0
stat("/home/d/.nmap/docs/nmap.1", {st_mode=S_IFREG|0664, st_size=183621, ...}) = 0
access("/usr/share/man/man1/nmap.1.gz", R_OK) = -1 ENOENT (No such file or directory)
write(2, "No manual entry for nmap in sect"..., 38No manual entry for nmap in section 1

为什么会这样,我该如何解决?我注意到 man 也在 ~/.nmap/docs 中寻找一个名为 index.db 的文件,但找不到,也许这是一个线索?

最佳答案

问题是 docs 目录没有 man 需要的目录结构(nmap.1 应该在 man1 子目录中),与使用-M 选项:

    -M path, --manpath=path
Specify an alternate manpath to use. By default, man uses
manpath derived code to determine the path to search. This
option overrides the $MANPATH environment variable and
causes option -m to be ignored.

A path specified as a manpath must be the root of a manual
page hierarchy structured into sections as described in the
man-db manual (under "The manual page system"). To view
manual pages outside such hierarchies, see the -l option.

当使用 make install 时,联机帮助页会安装到正确的类别子目录中。所以直接将 MANPATH 指向 docs 目录是行不通的。

关于linux - 如何让 `MANPATH=~/.nmap/doc man 1 nmap` 寻找 nmap.1?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30574036/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com