Skip to content

quote-at-expansion

Shellcorrectnessno fixdefault: errorshell/shellcheck

Reports an unquoted $@ or ${array[@]} in the arguments of a command.

Unquoted, each element is split again on blanks and globbed, so the arguments that were separate words are cut apart. Only "$@" keeps each argument as one word.

To fix, write "$@" or "${array[@]}".

Reported
...
diff <(sort a) <(sort b); echo <(date)
...
cp $@ dir
cp "$@" dir "${arr[@]}" ${arr[@]}
...
now=`date`
...
shell:
lint:
rules:
quote-at-expansion: error # off, warn, error (default)

Enabled by the presets: shell/shellcheck.

Suppress one line with sudsy-disable-next-line quote-at-expansion in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
shellcheck SC2068 partial Only the arguments of a command.