shell 检测安装包

检测 wget 是否存在

rpm -q wget >/dev/null
if [ "$?" -ge 1 ];then
    echo "install wget,Please wait..."
    yum -y install wget
    rpm -q wget >/dev/null
    [ $? -ge 1 ] && echo "wget installation failure,exit" && exit
     echo "wget done"
     read
fi
原文地址:https://www.cnblogs.com/sharesdk/p/8717376.html