It’s not very well documented, but it’s possible to include multiple conditional expressions in a single if statement in BASH. By multiple conditional expressions, I mean something like:
if foo = 1 or bar = 3 or abc = 4 then print Hello World end if
You can do boolean OR in BASH by using the
-o operator. The following is the above code written in BASH:
if [ $foo -eq 1 -o $bar -eq 3 -o $abc -eq 4 ]; then echo Hello World fi
For boolean AND, use the
-a operator. You can also intermix the two.