Groups of compound conditions in Bash test [duplicate]

Use the && (and) and || (or) operators:

if [[ expression ]] && [[ expression ]] || [[ expression ]] ; then

They can also be used within a single [[ ]]:

if [[ expression && expression || expression ]] ; then

And, finally, you can group them to ensure order of evaluation:

if [[ expression && ( expression || expression ) ]] ; then

Leave a Comment