Running in Circles
Programming loops allow one-time or multiple execution of instructions. The condition for the loop can exist both outside and inside it.
tiero, 123RF.com
Programming loops allow one-time or multiple execution of instructions. The condition for the loop can exist both outside and inside it.
With loops, you can execute part of a shell script over and over until an ending condition terminates it. You can use loops in menu controls and data processing. Without loops, you would need to start the scripts every time you wanted to process a piece of data.
A loop begins with for , while , or until (the loop header). After that follows a do statement that ends with done . Between do and done are the statements to execute (the loop body):
for / while / until [LOOP HEADER] do [commands] [LOOP BODY] done
[...]