Skip to content

Files

Latest commit

 

History

History
31 lines (20 loc) · 552 Bytes

SC1066.md

File metadata and controls

31 lines (20 loc) · 552 Bytes

Pattern: Use of $ on the left side of assignment

Issue: -

Description

Unlike Perl or PHP, $ is not used when assigning to a variable.

Example of incorrect code:

$greeting="Hello World"

Example of 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"

Further Reading