Bash Help

Loops For, While, and Until

From: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html

For loop example:

#!/bin/bash
for i in $( ls ); do
    echo item: $i
done

C like for loop:

#!/bin/bash
for i in `seq 1 10`;
do
    echo $i
done

While Example:

#!/bin/bash
COUNTER=0
while [  $COUNTER -lt 10 ]; do
    echo The counter is $COUNTER
    let COUNTER=COUNTER+1
done

Until example:

#!/bin/bash
COUNTER=20
until [  $COUNTER -lt 10 ]; do
    echo COUNTER $COUNTER
    let COUNTER-=1
done