split-command-output
What it does
Section titled “What it does”Reports an unquoted $(...) among the elements of an array assignment, as in arr=($(cmd)).
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”...d=($(cmd "$a"))...Configuration
Section titled “Configuration”shell: lint: rules: split-command-output: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line split-command-output in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| shellcheck | SC2207 |
full |