判断linux命令是否存在
作者:
疯言疯語 | 来源:发表于
2019-03-11 15:24 被阅读0次参考文档:https://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script
POSIX compatible:
command -v <the_command>
For bash specific environments:
hash <the_command> # For regular commands. Or...
type <the_command> # To check built-ins and keywords
Example:
if $(command -v test11 >/dev/null 2>&1); then
echo 'exists'
fi
if $(command -v test >/dev/null 2>&1); then
echo 'exists'
fi
本文标题:判断linux命令是否存在
本文链接:https://www.haomeiwen.com/subject/eskbpqtx.html
网友评论