mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC1087 (markdown)
@@ -14,7 +14,7 @@ echo "${array[@]}"
|
|||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
For compatibility reasons, `$foo[bar]` is interpreted as the variable `$foo` followed by the literal string `[bar]`.
|
Some languages use the syntax `$array[index]` to access an index of an arrays, but a shell will interpret this as `$array` followed by the unrelated literal string (or glob) `[index]`.
|
||||||
|
|
||||||
Curly braces are needed to tell the shell that the square brackets are part of the expansion.
|
Curly braces are needed to tell the shell that the square brackets are part of the expansion.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user