jeudi 27 août 2015

If condition in shell script with multiple conditions including check for null strings

What is wrong with the below syntax, I keep getting [: too many arguments

All the variables are strings, also I have introduced var3 and str3, two make sure we are not comparing two null values, is there any other better option to deal with it

if [ "$var1" = "$var2" = "$var3" && "$str1" = "$str2" = "$str3" ] then echo " something" elif [ "$var1" = "$var2" = "$var3"] then echo something else elif [ "$str1" = "str2" = "str3" ] then echo something else else exit fi

Aucun commentaire:

Enregistrer un commentaire