Updated SC2068 (markdown)

Vidar Holen
2020-07-25 17:44:48 -07:00
parent 7e185e9068
commit dbb029cf95

@@ -16,11 +16,11 @@ cp "$@" ~/dir
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 `/*/*/*/*`
`"$@"` will expand into exactly that: `baz`, `foo bar` and `*`
`"$@"` will expand into exactly that: `baz`, `foo bar`, `*` and `/*/*/*/*`
`$@` will expand into multiple other arguments: `baz`, `foo`, `bar`, `file.txt` and `otherfile.jpg`
`$@` will expand into multiple other arguments: `baz`, `foo`, `bar`, `file.txt`, `otherfile.jpg`, and (eventually) a list of most files on the system
Since the latter is rarely expected or desired, ShellCheck warns about it.