shell脚本多重判断案例
cpu=$1
mem=$2
if [ $cpu == 4 ];then
vcores=4
if [ "$mem" == "15G" ];then
mb=12288
elif [ "$mem" == "7.3G" ];then
mb=6200
fi
elif [ $cpu == 8 ];then
vcores=8
if [ "$mem" == "15G" ];then
mb=12288
elif [ "$mem" == "7.3G" ];then
mb=6200
fi
fi
#把2.txt的第三行中的a替换成b。
sed -i '3y/a/b/' 2.txt

浙公网安备 33010602011771号