Created SC1137 (markdown)

Vidar Holen
2022-10-19 21:01:03 -07:00
parent c2bc59efbe
commit 9831743319

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!