linux shell if 或和且的表示方法

或的表达方式

if [ "$a" = 1 ] || [ "$a" = "2" ];then

  echo $a

fi

且的表达方式

if [ "$a" = 1 ] && [ "$a" = "2" ];then

  echo $a

fi

原文地址:https://www.cnblogs.com/mfryf/p/2505985.html