On 20 December 2011 07:36, Girish Venkatachalam
<girishvenkatachalam at gmail.com> wrote:
....
Now, let us look at a simple while loop with counting. As I said, for
is only an iterator. It is not a
?real loop like while.
$ cat i.sh
let i=100
while [ $i -gt 0 ];
do
? ? ? ?echo $i
? ? ? ?let i--
done
This is a nice way to iterate with a while loop.
I repeat.
for takes a list of values beforehand and runs the loop thro' them
like list of files or
?list of numbers or list of strings or a combination.
while has a condition like in C and runs the loop infinitely till the
condition is true.