I would like to make curl
request with multiple headers.The solution would be to make this command :
curl -H "keyheader: value" -H "2ndkeyheader: 2ndvalue" ...
My goal is to use only one variable with all the headers like :
headers='-H "keyheader: value" -H "2ndkeyheader: 2ndvalue" '
curl $headers
to send
curl -H "keyheader: value" -H "2ndkeyheader: 2ndvalue"
Currently, the problem is : I can use '
or "
to declare my string, but bash
tries to run what's after "-H"
as arguments and then answers :
command unknown
Would like to know what is going wrong here.