SC2109 – ShellCheck Wiki

See this page on GitHub

Sitemap


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 is a static analysis tool for shell scripts. This page is part of its documentation.