Using Environment Variables in cURL Command - Unix

后端 未结 4 1280
面向向阳花
面向向阳花 2021-02-20 10:59

My question is very simple. I want to use environment variables in a cURL command sth similar to this:

curl -k -X POST -H \'Content-Type: application/json\' -d \         


        
4条回答
  •  粉色の甜心
    2021-02-20 11:49

    For less quoting, read from standard input instead.

    curl -k -X POST -H 'Content-Type: application/json' -d @- <

    -d @foo reads from a file named foo. If you use - as the file name, it reads from standard input. Here, standard input is supplied from a here document, which is treated as a double-quoted string without actually enclosing it in double quotes.

提交回复
热议问题