mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1053 (markdown)
21
SC1053.md
Normal file
21
SC1053.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
## Semicolons directly after 'else' are not allowed. Just remove it.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
if mycommand; then echo "True"; else; echo "False"; fi
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
if mycommand; then echo "True"; else echo "False"; fi```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
`else` keywords should not be followed by semicolons. It's not valid shell syntax.
|
||||||
|
|
||||||
|
You can follow them directly with a line break or another command.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
Reference in New Issue
Block a user