Wednesday, February 15, 2006

Bash Script: an Example

#script begin
j=5
MAX=10000
for ((nr=1; nr<$MAX; nr++))
do

let "t = $nr % $j"
case $j:$t in
5:3 ) nr=$nr-1; j=7;;
7:4 ) nr=$nr-1; j=9;;
9:5 ) break;;
*) j=5;;
esac;
done
echo
echo ============
echo Number = $nr

No comments: