dash and bash in this case are a little dead from the brain, they do not allow an empty loop, so you need to add the op command to execute this run, for example. true or : My tests show that : little faster, although they should be the same , you donβt know why:
time (i=100000; while ((i--)); do :; done)
n takes 0.262 seconds, and:
time (i=100000; while ((i--)); do true; done)
takes 0.293 seconds. Interesting:
time (i=100000; while ((i--)); do builtin true; done)
takes 0.356 seconds.
All measurements average 30 runs.
source share