How to escape single quotes into double quotes into single quotes

后端 未结 4 1583
误落风尘
误落风尘 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

    An usual workaround in such cases is to put the data in a file and post.

    $ cat post.json
    { "add": { "doc": { "uid": "79729", "text" : "I've got your number"} } }
    

    And then invoke:

    curl -H "Content-type:application/json" --data @post.json http://dumbdomain.com/solr/collection2/update/json
    

    This would obviate the need of escaping any quotes in the json.

提交回复
热议问题