command
command 只能跳过function,而不能跳过shell builtin
三个选项 -vV都是打印 -p 使用 default PATH 执行命令
bash默认PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
getconf retrieve the values POSIX or system configuration variables
command -p getconf PATH
Reimplement command
function command() { echo 'execute shell builtin `command` with args' "$@" builtin command "$@" }
type
#!/bin/env sh source /etc/rc.d/init.d/functions function pwd(){ action pwd true } echo -e '\e[7;45mDirect run pwd\e[0m' pwd echo -e '\e[5;42mRun command pwd\e[0m' command pwd if command -v pwd &> /dev/null;then action 'pwd exists?' true else action 'pwd exists?' false fi if command -pv pwd >& /dev/null;then action 'System pwd exists?' true else action 'System pwd exists?' false fi
标签:bin,exists,pwd,Command,usr,action,command,type From: https://www.cnblogs.com/dissipate/p/17254505.html