mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2068 (markdown)
@@ -1,4 +1,4 @@
|
|||||||
## Add double quotes around ${@}, otherwise it's just like $* and breaks on spaces.
|
## Double quote array expansions to avoid re-splitting elements.
|
||||||
|
|
||||||
### Problematic code:
|
### Problematic code:
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
Double quotes around `$@` prevents globbing and word splitting while still expanding to multiple separate arguments.
|
Double quotes around `$@` (and similarly, `${array[@]}`) prevents globbing and word splitting of individual elements, while still expanding to multiple separate arguments.
|
||||||
|
|
||||||
Let's say you have three arguments: `baz`, `foo bar` and `*`
|
Let's say you have three arguments: `baz`, `foo bar` and `*`
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user