quote-in-quotes
What it does
Section titled “What it does”Reports a word made of two double-quoted strings with unquoted text between them, where a quoted part has a blank, as in "say "hi" now".
Why it matters
Section titled “Why it matters”It is usually a quote that was meant to be inside the string, written without a backslash. The text between the quotes is outside any quotes, so it is split and globbed, and the words are not what the string looks like.
To fix, escape the inner quotes ("say \"hi\" now") or use single quotes outside.
Example
Section titled “Example”a="x "\""$v"\"" y"...Configuration
Section titled “Configuration”shell: lint: rules: quote-in-quotes: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line quote-in-quotes in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”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 | SC2140 |
partial | Only a word whose middle part touches a space inside one of the two strings (the "a "\""$b"\"" idiom). |