command - run a program¶
概要¶
command [OPTIONS] [COMMANDNAME [ARG ...]]
描述¶
command forces the shell to execute the program COMMANDNAME and ignore any functions or builtins with the same name.
In command foo, command is a keyword.
The following options are available:
- -a or --all
Prints all COMMAND found in
PATH, in the order found.- -q or --query
Return 0 if any of the given commands could be found, 127 otherwise. Don't print anything. For compatibility, this is also --quiet (deprecated).
- -s or --search (or -v)
Prints the external command that would be executed, or prints nothing if no file with the specified name could be found in
PATH.- -h or --help
顯示此指令的幫助資訊。
範例¶
command ls 為執行 ls 程式,即使同時存在名為 ls 的函式。command -s ls 會印出 ls 程式的路徑。command -q git; and command git log 只有在 git 存在時才會執行 git log。command -sq git and command -q git and command -vq git return true (0) if a git command could be found and don't print anything.