SC2108 – ShellCheck Wiki

See this page on GitHub

Sitemap


In [..](..), use && instead of -a.

Problematic code:

[[ "$1" = "-v" -a -z "$2" ]]

Correct code:

[[ "$1" = "-v" && -z "$2" ]]

Rationale:

-a for logical AND 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.