mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2154 (markdown)
12
SC2154.md
12
SC2154.md
@@ -4,7 +4,12 @@
|
|||||||
|
|
||||||
var=name
|
var=name
|
||||||
n=42
|
n=42
|
||||||
echo "$var_$n.jpg"
|
echo "$var_$n.jpg" # overextended
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
target="world"
|
||||||
|
echo "hello $tagret" # misspelled
|
||||||
|
|
||||||
### Correct code:
|
### Correct code:
|
||||||
|
|
||||||
@@ -12,6 +17,11 @@
|
|||||||
n=42
|
n=42
|
||||||
echo "${var}_$n.jpg"
|
echo "${var}_$n.jpg"
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
target="world"
|
||||||
|
echo "hello $target"
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
ShellCheck has noticed that you reference a variable that is not assigned. Double check that the variable is indeed assigned, and that the name is not misspelled.
|
ShellCheck has noticed that you reference a variable that is not assigned. Double check that the variable is indeed assigned, and that the name is not misspelled.
|
||||||
|
Reference in New Issue
Block a user