SC2110 – ShellCheck Wiki

See this page on GitHub

Sitemap


In [..](..), use || instead of -o.

Problematic code:

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

Correct code:

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

Rationale:

-o for logical OR is not supported in a [[ .. ]] expression. Use || instead.

Exceptions:

None.


ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.