help 显示有关内置命令的信息。帮助的来源是什么?它是否维护用于内置命令的数据库,还是读取每个内置命令的某些文件(类似于每个实用程序的联机帮助页)?
有时我发现它的信息似乎扩大了 --help
$ cd --help
bash: cd: --: invalid option
cd: usage: cd [-L|[-P [-e]]] [dir]
$ help cd
cd: cd [-L|[-P [-e]]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
with a slash (/), then CDPATH is not used.
If the directory is not found, and the shell option `cdable_vars' is set,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.
Options:
-L force symbolic links to be followed
-P use the physical directory structure without following symbolic
links
-e if the -P option is supplied, and the current working directory
cannot be determined successfully, exit with a non-zero status
The default is to follow symbolic links, as if `-L' were specified.
Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.
我以为help提取可执行文件的帮助部分,但是对于python脚本pdf-merge.py,它不是
$ help ./pdf-merge.py
bash: help: no help topics match `./pdf-merge.py'. Try `help help' or `man -k ./pdf-merge.py' or `info ./pdf-merge.py'.
$ ./pdf-merge.py --help
usage: pdf-merge.py [-h] [-v] [--ask] [--output OUTPUT] [--title TITLE]
[--author AUTHOR] [--keyword KEYWORD] [--pdftk PDFTK]
[--gs GS] [--pdfmarks PDFMARKS] [--unicode]
PDF [PDF ...]
Merge PDFs preserving bookmarks. Thanks to Larry Cai for suggesting that
Unicode be supported and for discussion about the `--pdfmarks` option.
positional arguments:
PDF an input PDF to merge
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
--ask pause for manual pdfmark tweaking
--output OUTPUT name of the output PDF
--title TITLE title of output PDF
--author AUTHOR author of output PDF
--keyword KEYWORD keywords for the output PDF
--pdftk PDFTK path to the pdftk executable
--gs GS path to the gs (Ghostscript) executable
--pdfmarks PDFMARKS path to pdfmarks file. If not given, a temporary file
is used. If given and the file is missing, execution
will stop after the file is created (before the
Ghostscript run). If given and the file exists, no
attempt will be make to use pdftk to generate the mark
file (I assume your input file is what you want).
--unicode instead of merging PDFs, convert PDF-formatted unicode
strings. For example `--unicode '<FEFF03B103B203B3>'
\u03b1\u03b2\u03b3`
man命令,以及在支持该info命令的系统中。
cd没有--help选择。您所看到的是尝试使用无效选项标志时获得的基本用法消息。