Skip to main content
5 of 12
added 6 characters in body

Interestingly enough, noone actually ever mentioned the truly fastest way to do bash loops:

x=4000000

declare -i i=0
while ((i++ < x)); do
  :
done

or for other than +1 iterations (slightly slower) use:

x=4000000

i=-1
while (((i += 1) < x)); do
  :
done

Which is about 17% faster than the C-like for loop.