forked from koalaman/shellcheck
-
Notifications
You must be signed in to change notification settings - Fork 0
SC2068
Gabriel A. Devenyi edited this page Jun 27, 2016
·
5 revisions
cp $@ ~/dircp "$@" ~/dirDouble 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 *
"$@" will expand into exactly that: baz, foo bar and *
$@ will expand into multiple other arguments: baz, foo, bar, file.txt and otherfile.jpg
Since the latter is rarely expected or desired, ShellCheck warns about it.
When you want globbing of individual elements.