The while Loop – Linux Shell Programming
The while Loop – Linux Shell Programming While loops repeat statements as long as the next Unix command is successful. For Example : #!/bin/sh i=1 sum=0 while [ $i -le 100 ]; do sum=`expr $sum + $i` i=`expr $i + 1` done echo The sum is $sum.