-
Notifications
You must be signed in to change notification settings - Fork 1.9k
SC2068
koalaman edited this page Mar 2, 2014
·
7 revisions
cp $@ ~/dir
cp "$@" ~/dir
Double quotes around $@ prevents globbing and word splitting 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.
None.