while loop inc a var help please

OK guys I think this is an easy one but i am having a bit of trouble getting a while loop I have to do what I want. I need it to increment a number 1 - 99 but I need it to use 2 digits. So not 1,2,3,4,5...99 but 01,02,03,04,05,06,07...10,11,12,...99. Always using 2 digits.

I tried this:

NUM="1"

while true; do
echo "$NUM"
NUM=$[$NUM + 1 ]

if [ "$NUM" == "99" ]; then
break
fi
done

I tried setting NUM to 01 initially but that just gives.

01
2
3
4
5

Any thoughts?

OK I tried to cheat but I get this:

NUM="1"

while true; do

if [ $NUM -lt 10 ]
then
NUM="0$NUM"
fi

echo "$NUM"

NUM=$[$NUM + 1]

if [ "$NUM" == "15" ]; then
    break
fi

done

01
02
03
04
05
06
07
08
./1: line 13: 08: value too great for base (error token is "08")

?????

zsh -c 'print -l {01..99}' 
bash -c 'i=1;while ((i < 100)); do printf "%.2d\n" $i;((i+=1));done'

A slow version for pre-POSIX shells:

sh -c 'i=1;while [ $i -lt 100 ]; do [ $i -lt 10 ] && echo 0$i || echo $i; i=`expr $i + 1`;done'

OK cool thanks.

I ended up changing the way I inced it to the:

i=`expr $i + 1`

format and I was good to go!

Thanks again!