seq -w will determine the width and normalize it.
for num in $(seq -w 01 05); do ... done
Apparently, this does not work in the latest versions of iOS, so you can install macports and use its seq version, or you can explicitly set the format:
seq -f '%02g' 1 3 01 02 03
But given the ugliness of the format specifications for such a simple problem, I prefer the Henk and Adrian solution that just uses Bash. Apple can't mess it up, as there is no generic version of the unix version of Bash:
echo {01..05}
Or:
for number in {01..05}; do ...; done
piojo Aug 27 '13 at 8:05 2013-08-27 08:05
source share