if statement - How to test in bash one or two conditions -


I have to check that there is nothing else but a variable:

  a = "6"; If ["$ a"! = "6"] || ["$ A"! = "4"]; Then echo "OK";  

Returns: OK

I just do not get it ...? !!

try

  if ["$ a"! = "6" -o "$ a"! = "4"] ...   

But it is not understood that this condition is always true ($ 4 can not be 4 and 6 at the same time). You might want to:

  instead of  and  if ["$ a"! = "6" -a "$ a"! = "4"] ...    

Comments

Popular posts from this blog

Out of index C/C++ -

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

objective c - how Set autolayout for multiple dynamic buttons and labells in iOS? -