Created SC1066 (markdown)

koalaman
2014-10-31 11:16:14 -07:00
parent ca7ccaaf4e
commit 2e78fd0626

23
SC1066.md Normal file

@@ -0,0 +1,23 @@
## Don't use $ on the left side of assignments.
### Problematic code:
$greeting="Hello World"
### Correct code:
greeting="Hello World"
Alternatively, if the goal was to assign to a variable whose name is in another variable (indirection), use `declare`:
name=foo
declare "$name=hello world"
echo "$foo"
### Rationale:
Unlike Perl or PHP, `$` is not used when assigning to a variable.
### Contraindications
None