Skip to content

split-command-output

Shellsuspiciousno fixdefault: offshell/shellcheck

Reports an unquoted $(...) among the elements of an array assignment, as in arr=($(cmd)).

The output is split on blanks and globbed, so a line with a space becomes several elements and a * becomes file names.

To fix, read the lines with mapfile -t arr < <(cmd) (bash) or a while read loop.

Reported
...
d=($(cmd "$a"))
...
shell:
lint:
rules:
split-command-output: warn # off (default), warn, error

Enabled by the presets: shell/shellcheck.

Suppress one line with sudsy-disable-next-line split-command-output in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
shellcheck SC2207 full