SC2034
The ShellCheck warning for a variable that is assigned but never read in the file.
In more detail
Often it is a typo or dead code. A variable written through a nameref or read by another script triggers it too, and then a disable directive with a reason is appropriate.
Related terms
- ShellCheck — A linter for shell scripts that reports quoting mistakes, portability problems and common bugs, each with a numbered code.
- nameref — A bash 4.3 variable declared with declare -n or local -n that acts as another name for a variable named by its value.
- ShellCheck directive — A comment such as # shellcheck disable=SC2086 that tells ShellCheck to skip one finding on the next line.
Taught in
- Shebangs, Permissions And Three Ways To Run — Bash Scripting & Command Line Automation
- Debugging: set -x, bash -n And Reading The Error — Bash Scripting & Command Line Automation
- eval, And What To Use Instead — Bash Scripting & Command Line Automation