-
Notifications
You must be signed in to change notification settings - Fork 2k
SC2338
This is an optional rule, which means that it has a special "long name" and is not enabled by default. See the optional page for more details. In short, you have to enable it with the long name instead of the "SC" code like you would with a normal rule:
enable=require-double-equals # SC2338
[[ "$x" = "$y" ]][[ "$x" == "$y" ]]ShellCheck has been explicitly asked to warn about uses of = for string comparisons in Bash tests in favor of ==.
Both = and == can be used for string equality comparisons in Bash. However, == more clearly communicates that an equality comparison is being performed, since a single = is commonly associated with assignment in programming languages.
Using == can therefore make the intent of the test easier to recognize at a glance.
This check is not enabled by default, and may have been turned on for your current project by someone who wants it enforced. You can still ignore it with a directive.
This suggestion only triggers for Bash scripts. It does not trigger for Sh or Ksh scripts, even when explicitly enabled.