disk=`cat /etc/system-release`
g1="CentOS Linux release 7"
g2="haha"
if [[ $disk =~ $g1 ]];then
    ehco "包含"
fi
if [[  ! $disk =~ $g1 ]];then
    ehco "不包含"
fi
if [[ ! $disk =~ $g2 ]];then
    echo "不是不包含"
fi
Logo

更多推荐