diff --git a/SC1066.md b/SC1066.md new file mode 100644 index 0000000..512ce43 --- /dev/null +++ b/SC1066.md @@ -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 \ No newline at end of file