6

nested logical expression in bash shell

view full story
linux-howto

http://www.unix.com – Please tell me how to nest logical expressions in bash. I would like to nest logical expressions for arguments of the "test" command on bash. The following pseudo-code shows my intention. Code: // pseudo code if (exp1 AND (exp2 OR exp3)) {   Output true; } else {   Output false; } The following bash code failed. Code: if test 1 -eq 1 -a ( 2 -eq 2 -o 2 -eq 3 ) then   echo "true" else   echo "false" fi The above bash code ended up with the following error message. syntax error near unexpected token `(' (HowTos)