Pattern: Use of spaces around =
in assignment
Issue: -
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
If you actually wanted to run a command named foo and provide =
as the first argument, simply quote it: foo "=" 42
.