首页 > 系统相关 >shell脚本多重判断案例

shell脚本多重判断案例

时间:2023-02-25 14:57:06浏览次数:40  
标签:多重 elif shell mb mem 案例 fi cpu

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

标签:多重,elif,shell,mb,mem,案例,fi,cpu
From: https://www.cnblogs.com/anslinux/p/17154416.html

相关文章