How to escape single quotes into double quotes into single quotes

后端 未结 4 1593
误落风尘
误落风尘 2020-12-03 02:52

Here is an example of command line that fit this description :

curl  http://dumbdomain.com/solr/collection2/update/json -H
\'Content-type:applic         


        
4条回答
  •  孤城傲影
    2020-12-03 03:26

    In case you're using Windows (this problem typically doesn't occur on *nix), you can pipe the output from echo to curl to avoid the escaping altogether:

    echo {"foo": "bar", "xyzzy": "fubar"} | curl -X POST -H "Content-Type: application/json" -d @- localhost:4444/api/foo
    

提交回复
热议问题