curl-users
curl: option --dns-servers 127.0.0.1: is unknown
Date: Sun, 10 May 2015 18:56:05 +0800
Hi Daniel,
See the following testings on my Debian Wheezy box:
werner_at_debian:~$ Dns_Servers="--dns-servers 127.0.0.1"
werner_at_debian:~$ curl -sI ${Dns_Servers+"${Dns_Servers}"} http://
ftp.cn.debian.org/debian/README
curl: option --dns-servers 127.0.0.1: is unknown
curl: try 'curl --help' or 'curl --manual' for more information
werner_at_debian:~$ Dns_Servers="127.0.0.1"
werner_at_debian:~$ curl -sI ${Dns_Servers+--dns-servers "${Dns_Servers}"}
http://ftp.cn.debian.org/debian/README
HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Sun, 10 May 2015 06:29:56 GMT
Content-Type: application/octet-stream
Content-Length: 1495
Last-Modified: Sat, 25 Apr 2015 10:33:41 GMT
Connection: keep-alive
ETag: "553b6d85-5d7"
Accept-Ranges: bytes
It seems the quoting "${Dns_Servers}" keeps the argument as one piece, and
thus curl will see it as a single unknown option "--dns-servers 127.0.0.1".
And curl's diagnostic message is (quotes added by me):
curl: option "--dns-servers 127.0.0.1": is unknown
curl knows an option "--dns-servers" with option argument "127.0.0.1", but
does not know an option with the name "--dns-servers 127.0.0.1".
I think, this should be treated as a bug of curl for doing
lexicographical analysis on the options. Conventionally, an option is
constituted by some characters without spaces in it.
And it can be assigned with certain argument as its value, the delimiter
between the option and its argument(s) is often a space or =.
Regards
-- Hongyi Zhao <hongyi.zhao_at_gmail.com> Xinjiang Technical Institute of Physics and Chemistry Chinese Academy of Sciences GnuPG DSA: 0xD108493 ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2015-05-10