[CentOS] Shell Script Question
Stephen Harris
lists at spuddy.orgThu Jul 10 00:51:47 UTC 2008
- Previous message: [CentOS] Shell Script Question
- Next message: [CentOS] Shell Script Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> What's the simplest way to increment the number 0000 up by one until some other 4 digit number while
> preserving leading zero's until the 1000's has a digit other than 0?
Lots of answers, depending on the shell. I like this version for ksh:
typeset -Z4 a=-1
while (( a++ < 1000 ))
do
print $a
done
Not enough use is made of typeset :-)
--
rgds
Stephen
- Previous message: [CentOS] Shell Script Question
- Next message: [CentOS] Shell Script Question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the CentOS mailing list