SC2272 – ShellCheck Wiki

See this page on GitHub


Command name contains ==. For comparison, use [ "$var" = value ].

Problematic code:


Correct code:

[ "$a/$b" = "foo/bar" ] 


ShellCheck found a command name that contains a ==. Most likely, this was intended as a kind of comparison.

To compare two values, use [ value1 = value2 ]. Both the brackets and the spaces around the = are relevant.


None, though you can quote the == to suppress the warning.

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