Cod*_*key 5 freebsd command-line posix man macos
我不敢问这个问题,但是对于 OS-X 和可能其他 POSIX 系统上的许多命令,我很难找到有关内置命令的所需文档。
例如,如果我想知道命令的-P选项cd做了什么,我希望man cd告诉我,但可惜它把我带到了可怕的“BSD 通用命令”页面。
许多这些命令(全部?)不支持 --help选项,所以我能做的最好的事情就是通过给出一个无效的选项来诱导一个简洁的使用消息。例如:
~ $ cd --tell-me-something-I-didnt-know-damn-you
-bash: cd: --: invalid option
cd: usage: cd [-L|-P] [dir]
Run Code Online (Sandbox Code Playgroud)
我找到了 POSIX 标准simple command 部分,这似乎很有用,但我觉得我错过了一些基本的东西。应该没有那么难。
获取有关内置命令的详细使用信息的正确方法是什么?
无需浏览 shell 手册页即可获得有关内置命令的帮助的简单方法是help:
$ 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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2292 次 |
| 最近记录: |