1 SC2269
Vidar Holen edited this page 2020-12-11 20:34:15 -08:00

This variable is assigned to itself, so the assignment does nothing.

Problematic code:

var="$var"

Correct code:

# If the goal is to do nothing
true

Rationale:

ShellCheck found a variable that is assigned to itself, e.g. x=$x. This obviously has no effect.

Double check what the assignment was supposed to do.

Exceptions:

None.

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!