linux shell判断某命令是否存在

阅读量: searchstar 2020-04-10 21:38:02
Categories: Tags:

参考:https://blog.csdn.net/soindy/article/details/73794548

例如判断apt命令是否存在

if command -v apt > /dev/null 2>&1; then
        APT=apt;
else
        APT=yum;
fi
echo $APT