命令
command
没有手册条目,但帮助显示如下:$ help command
command: command [-pVv] command [arg ...]
Execute a simple command or display information about commands.
Runs COMMAND with ARGS suppressing shell function lookup, or display
information about the specified COMMANDs. Can be used to invoke commands
on disk when a function with the same name exists.
Options:
-p use a default value for PATH that is guaranteed to find all of
the standard utilities
-v print a description of COMMAND similar to the `type' builtin
-V print a more verbose description of each COMMAND
Exit Status:
Returns exit status of COMMAND, or failure if COMMAND is not found.
问题
command -v
可以作为which
的替代吗?command
的目的和用法是什么?
sudo apt-get install manpages-posix
命令来安装manpages-posix。默认情况下未安装。点击这里查看详细信息。 - sourav c.command
,它只是静默退出了,实际上什么都没发生。谢谢你提出这个很棒的问题! - Sethhelp command
来获取内置命令的用法信息,而不必在man
页面中搜索。 - LawrenceCcommand something
会绕过名为something
的函数和别名,而\something
只会绕过别名something
但会执行函数。据我所知,没有办法只绕过函数而不绕过同名的别名。(你的回答说"它绕过了函数(...)直接进入内置或者你的路径",但没有明确提到它也绕过了别名,这可能仍然需要被写得明确一些以便理解) - Olivier Dulacvim /usr/bin/command
给出了builtin echo ${0##*/} | tr \[:upper:] \[:lower:]` ${1+"$@"}
。对于vim /usr/bin/alias
也是一样的。我想知道这是什么意思? - Ben Butterworthcommand
命令将绕过函数和别名。」 - Gabriel Staples