Passing a URL with brackets to curl

后端 未结 2 2025
时光取名叫无心
时光取名叫无心 2020-12-04 07:46

If I try to pass a URL to curl that contains brackets, it fails with an error:

$ curl \'http://www.google.com/?TEST[]=1\'
curl: (3) [globbing] illegal charac         


        
2条回答
  •  悲哀的现实
    2020-12-04 08:19

    Globbing uses brackets, hence the need to escape them with a slash \. Alternatively, the following command-line switch will disable globbing:

    --globoff (or the short-option version: -g)

    Ex:

    curl --globoff https://www.google.com?test[]=1
    

提交回复
热议问题