mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1061 (markdown)
31
SC1061.md
Normal file
31
SC1061.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
## Couldn't find 'done' for this 'do'.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yes() {
|
||||||
|
while echo "y"
|
||||||
|
do
|
||||||
|
true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yes() {
|
||||||
|
while echo "y"
|
||||||
|
do
|
||||||
|
true
|
||||||
|
done
|
||||||
|
}
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
ShellCheck found a `do` without a corresponding `done`.
|
||||||
|
|
||||||
|
Double check that the `done` exists, and that it correctly matches the indicated `do`. A companion warning [[SC1062]] is emitted where ShellCheck first noticed it was missing.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None.
|
Reference in New Issue
Block a user