We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
"$@"
Or: Use "${array[@]}" (with quotes) to prevent whitespace problems.
cp $* ~/dir cp ${array[*]} ~/dir
cp "$@" ~/dir cp "${array[@]}" ~/dir
$* and ${array[*]}, unquoted, is subject to word splitting and globbing.
$*
${array[*]}
Let's say you have three arguments or array elements: baz, foo bar and *
baz
foo bar
*
"$@" and "${array[@]}" will expand into exactly that: baz, foo bar and *
"${array[@]}"
$* and ${array[*]} 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.