在Bash中,如何判断某个命令是否存在?

if ! type "$foobar_command_name" > /dev/null; then
  # install foobar here,or poping up some warning messages
fi



references:
http://stackoverflow.com/questions/7522712/how-to-check-if-command-exists-in-a-shell-script
http://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script
posted @ 2014-11-12 16:30  foo__hack  阅读(491)  评论(0编辑  收藏  举报