Skip to content
Joachim Ansorg edited this page Nov 12, 2021 · 4 revisions

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.

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature guerraart8 to find a specific , or see Checks.

Clone this wiki locally