mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC3009 (markdown)
16
SC3009.md
16
SC3009.md
@@ -1,9 +1,21 @@
|
|||||||
**In POSIX `sh`, brace expansion is undefined.**
|
## In POSIX `sh`, brace expansion is undefined.
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
Problematic code:
|
|
||||||
```
|
```
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
for i in {1..5}; do ...
|
for i in {1..5}; do ...
|
||||||
```
|
```
|
||||||
|
|
||||||
Here, `$i` expands to `{1..5}`. It does **not** expand to the sequence `1 2 3 4 5`
|
Here, `$i` expands to `{1..5}`. It does **not** expand to the sequence `1 2 3 4 5`
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
For simple sequences of numbers, you may use the `seq` command, e.g. `seq 1 5`.
|
||||||
|
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
||||||
|
Reference in New Issue
Block a user