Skip to content

Files

Latest commit

 

History

History
27 lines (16 loc) · 579 Bytes

SC2077.md

File metadata and controls

27 lines (16 loc) · 579 Bytes

Pattern: Missing spaces around =

Issue: -

Description

[[ 0 = 1 ]] means "check if 0 and 1 are equal".

[[ str ]] is short form for [[ -n str ]], and means "check if str is non-empty". It doesn't matter if str happens to contain 0=1.

Always use spaces around the comparison operator in [..] and [[..]], otherwise it won't be recognized as an operator.

Example of incorrect code:

[[ 0=1 ]]

Example of correct code:

[[ 0 = 1 ]]

Further Reading