cp $* ~/dir
cp "$@" ~/dir
$*, unquoted, is subject to word splitting and globbing.
$*
Let's say you have three arguments: baz, foo bar and *
baz
foo bar
*
"$@" will expand into exactly that: baz, foo bar and *
"$@"
$* will expand into multiple other arguments: baz, foo, bar, file.txt and otherfile.jpg
foo
bar
file.txt
otherfile.jpg
Since the latter is rarely expected or desired, ShellCheck warns about it.
None.
There was an error while loading. Please reload this page.