mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC1137 (markdown)
30
SC1137.md
Normal file
30
SC1137.md
Normal file
@@ -0,0 +1,30 @@
|
||||
## Missing second '(' to start arithmetic for ((;;)) loop
|
||||
|
||||
### Problematic code:
|
||||
|
||||
```sh
|
||||
for (i=0; i<10; i++))
|
||||
do
|
||||
echo $i
|
||||
done
|
||||
```
|
||||
|
||||
### Correct code:
|
||||
|
||||
```sh
|
||||
for ((i=0; i<10; i++))
|
||||
do
|
||||
echo $i
|
||||
done
|
||||
```
|
||||
### Rationale:
|
||||
|
||||
ShellCheck found an arithmetic `for ((;;))` expression where either the `((` or the `))` did not come as a pair. Make sure to use `(( ))` and not `( )`.
|
||||
|
||||
### Exceptions:
|
||||
|
||||
None.
|
||||
|
||||
### Related resources:
|
||||
|
||||
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user