Hi!

On Tue, Jul 22, 2008 at 09:32:15AM -0500, Daniel A. Ramaley wrote:
>On Tuesday July 22 2008 09:04, you wrote:
>>> for i in 1 2 3 4 5 6 7 8 9; do
>>>   ftp http://openbsd.org/faq/faq0${i}.html
>>> done
>>> for i in 10 11 12 13 14 15; do
>>>   ftp http://openbsd.org/faq/faq${i}.html
>>> done

>>Wouldn't it be simpler to be done in one loop?

>>for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
>>      ftp http://openbsd.org/faq/faq${i}.html
>>done
>>ftp http://openbsd.org/faq/index.html

>Note that the 2 loops are not the same. You'd need:

>for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
>       ftp http://openbsd.org/faq/faq`printf %02d $i`.html
>done

>The number list could be collapsed into `seq 1 15` on a system with seq 
>installed.

jot(1) helps.

$ jot 15 1                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$ jot -w%02d 15 1
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
$ 

Kind regards,

Hannah.

Reply via email to