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

posted @ 2023-02-25 14:47  安生丶  阅读(43)  评论(0)    收藏  举报