mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2194 (markdown)
26
SC2194.md
Normal file
26
SC2194.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
## This word is constant. Did you forget the $ on a variable?
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
case foo in
|
||||||
|
bar) echo "Match"
|
||||||
|
esac
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
case $foo in
|
||||||
|
bar) echo "Match"
|
||||||
|
esac
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
You are using a `case` statement to compare a literal word.
|
||||||
|
|
||||||
|
You most likely wanted to treat this word as a `$variable` or `$(command)` instead.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
Reference in New Issue
Block a user