Empty Body For Loop Linux Shell Empty Body For Loop Linux Shell shell shell

Empty Body For Loop Linux Shell


You must specify at least one command in a loop body.

The best comand fo such purposes ia a colon :, commonly used as a no-op shell command.


You could put a no op command inside the loop like true or false (do nothing successfully or unsuccessfully respectively).

This will be a tight loop and will burn CPU. Unless you want to warm up your computer on a cold morning, you can simply say i=1000000 and have the same effect as the loop.

What is it that you're trying to achieve?


#!/bin/bashlet i=0 while [[ $i -le 1000000 ]]; do  let i++ done