无法在shell提示符中复制多行curl命令

时间:2017-08-30 11:16:13

标签: linux shell curl elasticsearch

我试图在shell中运行multiline curl命令但无法运行它

curl -XPUT 'elk.***.com:9200/_snapshot/my_backup' \
        { 
            "type": "fs", 
            "settings": { 
            "location": "/elkprod_bak/elkback", 
            "compress": true 
                } 
        } 

1 个答案:

答案 0 :(得分:0)

您需要在命令行中使用-d switch,如下所示:

curl -XPUT 'elk.***.com:9200/_snapshot/my_backup' -d '{ 
        "type": "fs", 
        "settings": { 
          "location": "/elkprod_bak/elkback", 
          "compress": true 
        } 
}'