4 SC2109
Joachim Ansorg edited this page 2021-11-12 19:34:03 +01:00

Instead of [ a || b ], use [ a ] || [ b ].

Problematic code:

[ "$1" = "-v" || "$1" = "-help" ]

Correct code:

[ "$1" = "-v" ] || [ "$1" = "-help" ]

Rationale:

|| cannot be used in a [ .. ] test expression. Instead, make two [ .. ] expressions and put the || between them.

Exceptions:

None.