How do you view a man page you just created?

假如想象 提交于 2019-12-04 05:19:27

问题


Suppose I have a man page, which I just wrote and passed through nroff -man, called command.1

How do I view it with man now? I looked though the man man page, and maybe I missed it, but I didn't see anything. I also searched google.

Is it only possible to view using nroff -man? Is there a command line option for man to view that specific file? Is it necessary to modify MANPATH?


回答1:


Put the command.1 man page in a new folder called man1. Then, assuming you're in the folder containing the new man1 folder, call the man command like this:

man -M . command

Replace the dot by the path to the folder containing the man1 folder if you're located elsewhere.




回答2:


There are different versions of man floating around: the one based on the man-db project (used in many Linux distros) and the one that comes with macOS, at least as far as I know. I was unable to find a project page for the latter, but it seems to be maintained by Federico Lucifredi.

The main point is this: Lucifredi's man supports opening a file directly when providing the path to it with a slash:

man ./command.1

This is mentioned in the macOS man page for man:

However, if name contains a slash (/) then man interprets it as a file specification, so that you can do man ./foo.5 or even man /cd/foo/bar.1.gz.

and it's also hinted at in a blog post by Lucifredi:

One more tip for you:

man ./foo.1

is your friend, to see what you just wrote and marked up in all its glory — and bugs.



来源:https://stackoverflow.com/questions/22614728/how-do-you-view-a-man-page-you-just-created

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!