Skip to content
Joachim Ansorg edited this page Oct 31, 2022 · 7 revisions

In POSIX sh, brace expansion is undefined.

Problematic code:

#!/bin/sh

for i in {1..5}; do ...

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

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally