mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1089 (markdown)
34
SC1089.md
Normal file
34
SC1089.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
## Parsing stopped here. Is this keyword correctly matched up?
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
if true
|
||||||
|
then
|
||||||
|
echo hello
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
if true
|
||||||
|
then
|
||||||
|
echo hello
|
||||||
|
fi
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
This error is typically seen when there are too many `fi`, `done` or `esac`s, or when there's a `do` or `then` without a corresponding `while`, `for` or `if`. This is often due to deleting a loop or conditional statement but not its terminator.
|
||||||
|
|
||||||
|
In some cases, it can even be caused by bad quoting:
|
||||||
|
|
||||||
|
var="foo
|
||||||
|
if [[ $var = "bar ]
|
||||||
|
then
|
||||||
|
echo true
|
||||||
|
fi
|
||||||
|
|
||||||
|
In this case, the `if` ends up inside the double quotes, leaving the `then` dangling.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None.
|
Reference in New Issue
Block a user