shell编程if遇到多条件时能否简化
比如if["$3"=""]||["$3"="1"]||["$3"="2"]||["$3"="3"]||["$3"="4"]||["$3"="5"]||["$3"="6"]...
比如
if [ "$3" = "" ] || [ "$3" = "1" ] || [ "$3" = "2" ] || [ "$3" = "3" ] || [ "$3" = "4" ] || [ "$3" = "5" ] || [ "$3" = "6" ] || [ "$3" = "7" ];then
我要判断$3等于空或者等于1~7
这样写太臃肿了,能否简化写? 展开
if [ "$3" = "" ] || [ "$3" = "1" ] || [ "$3" = "2" ] || [ "$3" = "3" ] || [ "$3" = "4" ] || [ "$3" = "5" ] || [ "$3" = "6" ] || [ "$3" = "7" ];then
我要判断$3等于空或者等于1~7
这样写太臃肿了,能否简化写? 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询