assignment-space
What it does
Section titled “What it does”Reports a command prefix var= cmd, at the start of the command.
Why it matters
Section titled “Why it matters”The space ends the assignment, so var is set to the empty string for cmd, and cmd runs. var=value cmd was almost always meant.
To fix, remove the space, or quote the empty value if it is meant (var="" cmd).
Example
Section titled “Example”...echo "$@" "${s[@]}"PGHOST= psqlIFS= read -r linePGHOST=db psql...Configuration
Section titled “Configuration”shell: lint: rules: assignment-space: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line assignment-space 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 | SC1007 |
partial | Only a command prefix var= cmd (not IFS=), reported at the start of the command. |