mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2269 (markdown)
28
SC2269.md
Normal file
28
SC2269.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
## This variable is assigned to itself, so the assignment does nothing.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
var="$var"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# 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!
|
Reference in New Issue
Block a user