man 命令令人惊讶地接受参数 ``git diff``

wnr*_*rph 2 ubuntu

今天,我不小心输入了man git diffwhich 应该没有结果,因为根据手册,它应该被解释为git部分中的页面差异。但是,实际上显示了页面git-diff(1)。怎么可能?(使用 Ubuntu Lucid 中包含的 man 2.5.7)

小智 6

Ubuntu 上的 man(1) 说:

--no-subpages
              By default, man will try to interpret pairs of manual page names given on the command line as
              equivalent to a single manual page name containing a hyphen.  This supports the  common  pat-
              tern  of  programs  that  implement  a number of subcommands, allowing them to provide manual
              pages for each that can be accessed using similar syntax as would be used to invoke the  sub-
              commands themselves.  For example:

                $ man -aw git diff
                /usr/share/man/man1/git-diff.1.gz

              To disable this behaviour, use the --no-subpages option.

                $ man -aw --no-subpages git diff
                /usr/share/man/man1/git.1.gz
                /usr/share/man/man3/Git.3pm.gz
                /usr/share/man/man1/diff.1.gz
Run Code Online (Sandbox Code Playgroud)