Skip to content

Files

Latest commit

 

History

History
28 lines (17 loc) · 734 Bytes

SC1108.md

File metadata and controls

28 lines (17 loc) · 734 Bytes

Pattern: Missing space before =

Issue: -

Description

You appear to be missing the space on the left side of the operator. Shell in general, and [ in particular, is space sensitive. Operators and operands must be separate tokens.

Please ensure that the operator, like the = in the example, has a space both before and after it.

Example of incorrect code:

[ "$var"= 2 ]

Example of correct code:

[ "$var" = 2 ]

Exceptions

None. If you're comparing values in C style reverse order like [ -eq == $1 ], use quotes: [ "-eq" == "$1" ]. Also, it's pointless since [ a = b ] doesn't assign.

Further Reading