Using Environment Variables in cURL Command - Unix

后端 未结 4 1264
面向向阳花
面向向阳花 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:48

    Single quotes inhibit variable substitution, so use double quotes. The inner double quotes must then be escaped.

    ...  -d "{\"username\":\"$USERNAME\",\"password\":\"$PASSWORD\"}"
    

提交回复
热议问题