依照指示此问答我开始使用command
而不是which
来检查程序是否存在。
但man command
返回:
No manual entry for command
为什么默认没有手册?我该如何安装它?我正在使用Ubuntu 16.04.5 LTS
。
答案1
以下是我的发现:
walt@bat:~(0)$ type command
command is a shell builtin
walt@bat:~(0)$ man bash | grep -E '^\s+command '
command (see SHELL GRAMMAR below) or the third word of a case or for command:
command listed under Compound Commands above. compound-command is executed whenever name is specified as the name of a simple command. When in posix mode, name
command to abort.
command substitution, or parameter expansion.
command name, the list of commands associated with that function name is executed. Functions are executed in the context of the current shell; no new process is created
command to abort.
command name.
command below.
command is immediately followed by a character that is neither a digit or minus sign, the argument count for the next command is multiplied by four. The argument
command as it would appear in .inputrc, but each binding or command must be passed as a separate argument; e.g., '"\C-x\C-r": re-read-init-file'. Options, if sup‐
command [-pVv] command [arg ...]
command Command names. May also be specified as -c.
command is executed in a subshell environment, and its output is used as the possible completions.
command name from shared object filename, on systems that support dynamic loading. The -d option will delete a builtin previously loaded with -f. If no name
command in a pipeline but the last, or if the command's return value is being inverted using !. These are the same conditions obeyed by the errexit (-e) option.
walt@bat:~(0)$ man bash | grep -E -A8 '^\s+command \[-pVv'
command [-pVv] command [arg ...]
Run command with args suppressing the normal shell function lookup. Only builtin commands or commands found in the PATH are executed. If the -p option is given,
the search for command is performed using a default value for PATH that is guaranteed to find all of the standard utilities. If either the -V or -v option is sup‐
plied, a description of command is printed. The -v option causes a single word indicating the command or filename used to invoke command to be displayed; the -V
option produces a more verbose description. If the -V or -v option is supplied, the exit status is 0 if command was found, and 1 if not. If neither option is
supplied and an error occurred or command cannot be found, the exit status is 127. Otherwise, the exit status of the command builtin is the exit status of com‐
mand.
compgen [option] [word]
walt@bat:~(0)$