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

Missing second ( to start arithmetic for ((;;)) loop

Problematic code:

for (i=0; i<10; i++))
do
  echo $i
done

Correct code:

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!

ShellCheck

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

Clone this wiki locally