04 May 2010
判断命令是否存在于$PATH中
一
[jean@jeantoe /]$ command -v ls >/dev/null && echo “command Found In $PATH” | echo “command Not Found in $PATH” |
command1 Found In $PATH
[jean@jeantoe /]$ command -v ss >/dev/null && echo “command Found In $PATH” | echo “command Not Found in $PATH” |
command Found In $PATH
二
[jean@jeantoe /]$ type -P command1 &>/dev/null && echo “Found” | echo “Not Found” |
Not Found