Tuesday, September 21, 2010

Shell Script while loop

Shell script is space sensetive,
There are space between "[" and "$i"
you have to use double parentheses.


While loop:

#!/bin/bash
i=1
while [ $i -le 100 ] # loop 100 times
do
./readCMOSflag
i=$(( $i + 1 ))
# or you could use (( i++ ))
done

No comments: