quote-command-substitution
What it does
Section titled “What it does”Reports an unquoted $(...) or backtick substitution in the arguments of a command.
Why it matters
Section titled “Why it matters”The output is split on blanks and globbed, so a result with spaces becomes several arguments, an empty one disappears, and a * becomes file names.
To fix, quote it: "$(cmd)".
Example
Section titled “Example”...cat -n in.txt | grep xcat a b | grep xgrep x in.txtecho $(date)...echo `date`echo "$(date) now" $xecho "$(date)s"...Configuration
Section titled “Configuration”shell: lint: rules: quote-command-substitution: warn # off, warn (default), errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line quote-command-substitution 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 | SC2046 |
full |