Skip to content
Vidar Holen edited this page Dec 12, 2020 · 1 revision

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally

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.

Related resources:

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