How do you view a man page you just created?

前端 未结 2 1597
北海茫月
北海茫月 2021-01-27 01:48

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 lo

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-27 02:04

    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.

提交回复
热议问题