shell中,我们可以通过简单的一个判断来判断命令是否存在

shell中,我们可以通过简单的一个判断来判断命令是否存在

which "Command" > /dev/null
if [ $? -eq 0 ]
then
    echo command is exist
else
    echo command not exist
fi

 

posted @ 2018-07-14 16:12  水中的火柴盒  阅读(2780)  评论(0编辑  收藏  举报