传递一个带括号的URL来curl

如果我尝试传递一个包含括号的URL,则会失败,并显示错误消息:

$ curl 'http://www.google.com/?TEST[]=1' curl: (3) [globbing] illegal character in range specification at pos 29 

但是,如果我从两个括号中逃脱,它似乎工作:

 $ curl 'http://www.google.com/?TEST\[\]=1' 

有趣的是,我用一个反斜杠来转义只有第一个括号失败,默默地错误代码20497:

 $ curl 'http://www.google.com/?TEST\[]=1' $ echo $! 20497 

我的问题是如何解决这个一般情况下? 是否有一个参数会自动跳过url,或者在传递curl之前需要转义的字符的描述?

没关系,我在文档中find它:

 -g/--globoff This option switches off the "URL globbing parser". When you set this option, you can specify URLs that contain the letters {}[] without having them being interpreted by curl itself. Note that these letters are not normal legal URL contents but they should be encoded according to the URI standard.