2 SC1060
Joachim Ansorg edited this page 2022-10-31 15:10:13 +01:00

Can't have empty do clauses (use true as a no-op)

Problematic code:

for i in 1 2 3; do
done

Correct code:

for i in 1 2 3; do
  true
done

Rationale:

An empty do ... done block is not valid. Use true or : if you need no command at all.

Exceptions:

None.

  • Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!