Home

zhangyiqun

Thoughts, stories and ideas.

Notes Blog Archives About
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

Notes Blog Archives About