mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1059 (markdown)
34
SC1059.md
Normal file
34
SC1059.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
## Semicolon is not allowed directly after 'do'. You can just delete it.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
while true; do; true; done
|
||||||
|
|
||||||
|
while true;
|
||||||
|
do;
|
||||||
|
true;
|
||||||
|
done;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
while true; do true; done
|
||||||
|
|
||||||
|
while true;
|
||||||
|
do
|
||||||
|
true;
|
||||||
|
done;
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
Semicolon `;` is not allowed directly after a `do` keyword. Follow it directly with either a command or a linefeed as shown in the example.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
### Related resources:
|
||||||
|
|
||||||
|
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user