mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2051 (markdown)
@@ -2,17 +2,21 @@
|
|||||||
|
|
||||||
### Problematic code:
|
### Problematic code:
|
||||||
|
|
||||||
|
```bash
|
||||||
for i in {1..$n}
|
for i in {1..$n}
|
||||||
do
|
do
|
||||||
echo "$i"
|
echo "$i"
|
||||||
done
|
done
|
||||||
|
```
|
||||||
|
|
||||||
### Correct code:
|
### Correct code:
|
||||||
|
|
||||||
|
```bash
|
||||||
for ((i=0; i<n; i++))
|
for ((i=0; i<n; i++))
|
||||||
do
|
do
|
||||||
echo "$i"
|
echo "$i"
|
||||||
done
|
done
|
||||||
|
```
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
@@ -34,4 +38,4 @@ done < <(eval "printf '%s\0' $(printf "{%q..%q}.jpg" "$from" "$to")")
|
|||||||
|
|
||||||
### Exceptions
|
### Exceptions
|
||||||
|
|
||||||
None (if you're writing for e.g. zsh, make sure the shebang indicates this so shellcheck won't warn)
|
None (if you're writing for e.g. zsh, make sure the shebang indicates this so shellcheck won't warn)
|
||||||
|
Reference in New Issue
Block a user