使用不等于运算符进行字符串比较
我试图检查该PHONE_TYPE变量是否包含三个有效值之一。 if [ "$PHONE_TYPE" != "NORTEL" ] || [ "$PHONE_TYPE" != "NEC" ] || [ "$PHONE_TYPE" != "CISCO" ] then echo "Phone type must be nortel,cisco or nec" exit fi 上面的代码对我不起作用,所以我尝试了一下: if [ "$PHONE_TYPE" == "NORTEL" ] || [ "$PHONE_TYPE" == "NEC" ] || [ "$PHONE_TYPE" == "CISCO" ] then …