Need help with a simple script shell script
I need a simple shell script that can autoincrement numbers, starting at one (001), thru 999.
The catch: the preceding zero's are required.
Here's what I've got:
#!/bin/sh
num=001
while [ $num -lt 1000 ];do
echo $num
num=$(($num+001))
done
This results in the following output:
001
2
3
4
5
6
7. . .etc
Is there a simple way to cause it to output, and not truncate, the leading zeros???
I'm sure it's something simple, but this is driving me nuts, so any suggestions would be appreciated.
Thanks
|