SC1137 – ShellCheck Wiki

See this page on GitHub

Sitemap


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.


ShellCheck is a static analysis tool for shell scripts. This page is part of its documentation.