From: Hongyi Zhao on
On Thu, 4 Feb 2010 12:18:29 +0000 (UTC), Stephane CHAZELAS
<stephane_chazelas(a)yahoo.fr> wrote:

>url=http://www.google.com/
>file=myfile
>(
> set -C
> ext= n=0
> until command exec 3> "$file$ext"; do
> ext=.$((++n))
> done
> exec curl "$url" >&3
>)

I've another issue on the above code:

When I run it for the first time, I'll obtain a file with the name
myfile. My issue is: the initial value of ext should be _.0_, so I
think the above script should name the output as myfile.0. Any hints
on this?

Thanks again.
--
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
From: Hongyi Zhao on
On Mon, 8 Feb 2010 17:52:55 +0000 (UTC), Stephane CHAZELAS
<stephane_chazelas(a)yahoo.fr> wrote:

>>>url=http://www.google.com/
>>>file=myfile
>>>(
>>> set -C
>>> ext= n=0
>>> until command exec 3> "$file$ext"; do
>>> ext=.$((++n))
>>> done
>>> exec curl "$url" >&3
>>>)
>>
>> I've another issue on the above code:
>>
>> When I run it for the first time, I'll obtain a file with the name
>> myfile. My issue is: the initial value of ext should be _.0_, so I
>> think the above script should name the output as myfile.0. Any hints
>> on this?
>
>
>It shouldn't be that hard to figure it out by yourself.

My poor English. In fact, I want to know why your original code will
name the first downloaded file as myfile instead of myfile.0.
According to my understanding, it should also name the first
downloaded file as myfile.0 just as the below code does. Any hints?

>
>url=http://www.google.com/
>file=myfile
>(
> set -C
> n=0
> until { command exec 3> "$file.$n"; } 2> /dev/null; do
> n=$(($n + 1))
> done
> exec curl "$url" >&3
>)

Regards.
--
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.
From: Hongyi Zhao on
On Tue, 9 Feb 2010 21:16:02 +0000 (UTC), Stephane CHAZELAS
<stephane_chazelas(a)yahoo.fr> wrote:

>You could try to add a "set -x" at the top, to see what happens.

Thanks again, I've seen.
--
..: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :.