If want to express the following test in shell (sh) :
if ( a == 1 && ( b == 1 || b == 2 )) { ... }
So far, the best I have been able to write is this :
if [[ $a -eq 1 ]]; then
if [[ $b -eq 1 || $b -eq 2 ]]; then
...
fi
fi
I don't know how to compound && and || with correct precedence. Googling has not given me any answer (tutorials only give basic examples, if any)
What is the syntax to combine those two if into one ?