Skip to content

Files

Latest commit

 

History

History
27 lines (16 loc) · 575 Bytes

SC1068.md

File metadata and controls

27 lines (16 loc) · 575 Bytes

Pattern: Use of spaces around = in assignment

Issue: -

Description

Shells are space sensitive. foo=42 means to assign 42 to the variable foo. foo = 42 means to run a command named foo, and pass = as $1 and 42 as $2.

Example of incorrect code:

foo = 42

Example of correct code:

foo=42

Exceptions

If you actually wanted to run a command named foo and provide = as the first argument, simply quote it: foo "=" 42.

Further Reading