read-without-raw
What it does
Section titled “What it does”Reports a read without -r.
Why it matters
Section titled “Why it matters”Without -r, read treats a backslash in the input as an escape: it removes it and joins the next line. Paths and text with a backslash come out wrong.
To fix, write read -r.
Example
Section titled “Example”...echo "$(date) now" $xecho "$(date)s"read lineread -r lineread -p "x" -r line...Configuration
Section titled “Configuration”shell: lint: rules: read-without-raw: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line read-without-raw 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 | SC2162 |
full |