mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Added meaningful page for apparently broken content
33
SC1060.md
33
SC1060.md
@@ -1,6 +1,29 @@
|
|||||||
#!/bin/sh
|
## Can't have empty do clauses (use `true` as a no-op)
|
||||||
CPU_TARGET_FREQ=$1
|
|
||||||
CORE=$2
|
### Problematic code:
|
||||||
for n in {1..$CORE}
|
|
||||||
do
|
```sh
|
||||||
|
for i in 1 2 3; do
|
||||||
done
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
for i in 1 2 3; do
|
||||||
|
true
|
||||||
|
done
|
||||||
|
```
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
An empty `do ... done` block is not valid.
|
||||||
|
Use `true` or `:` if you need no command at all.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None.
|
||||||
|
|
||||||
|
### Related resources:
|
||||||
|
|
||||||
|
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user