unset-glob
What it does
Section titled “What it does”Reports unset name[i] with an unquoted subscript.
Why it matters
Section titled “Why it matters”The word name[i] is a glob pattern too. If a file called namei exists in the directory, the shell replaces the word with it and unsets that name.
To fix, quote it: unset 'name[i]'.
Example
Section titled “Example”...IFS= read -r linePGHOST=db psqlunset words[0]unset "words[0]"...[[ $a == "$b" ]]...Configuration
Section titled “Configuration”shell: lint: rules: unset-glob: warn # off (default), warn, errorEnabled by the presets: shell/shellcheck.
Suppress one line with sudsy-disable-next-line unset-glob 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 | SC2184 |
partial | Only unset name[...]. |