cURL / Mailing Lists / curl-users / Single Mail


Re: curl oddity on cygwin

From: Ralph Mitchell <>
Date: Tue, 28 Jan 2003 04:19:12 -0600

OK, I tried it as you wrote it, and got the same result - the first file was saved and
the second went to stdout.

However, you need to watch out for things like {} and [] in Unix shells such as bash,
because they cause odd things to happen...

Try it again with double-quotes around the url and you'll get exactly what you
expected to get.

Also try doing "set -x" and then re-run your original command line - what I'm seeing
is that the url is replicated, like so:

    curl -o "file_#1.htm" http://localhost/first.htm http://localhost/second.htm

Curl is applying the "-o file_#1.htm" only to the first url, as alluded to in the "-o"
section of the man page:

    "You may use this option as many times as you have number of URLs."

So, curl is working as designed - it's the shell special characters that are biting

Ralph Mitchell wrote:

> Okay, I already enquired on the cygwin list whether anyone knew anything
> about this, but by the deafening silence I gather not.
> When using a command line of the form
> $ curl -o "file_#1.htm" -x localhost:8000 {first,second}.htm
> the result I get is as follows:
> $ ls -la *.htm
> -rw-r--r-- 1 Gary users 4189 Jan 25 08:39 file_1.htm
> and the second file sent to stdout. Neither is what I would
> expect given the man page:
> -o/--output <file>
> Write output to <file> instead of stdout. If you are using {} or
> [] to fetch multiple documents, you can use '#' followed by a
> number in the <file> specifier. That variable will be replaced
> with the current string for the URL being fetched. Like in:
> curl http://{one,two} -o "file_#1.txt"
> From reading that I expected to have files file_first.htm
> and file_second.htm as my results, sitting on the HD. Am I
> misreading the man page or is there a bug in there
> somewhere? If the latter, can someone compare with curl on
> another OS and see whether the results are the same? (Note:
> I would have expected to see people screaming on this list
> if that were the case!)
> $ curl -V
> curl 7.10.2 (i686-pc-cygwin) libcurl/7.10.2 OpenSSL/0.9.6h zlib/1.1.4
> $ uname
> CYGWIN_98-4.10 daisy 1.3.19(0.71/3/2) 2003-01-23 21:31 i686 unknown unknown Cygwin
> _______________________________________________________
> The FREE service that prevents junk email
> -------------------------------------------------------
> This SF.NET email is sponsored by:
> SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!

This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
Received on 2003-01-28