I have a problem when using curl on my linux script:
#!/bin/bash userName="user"; passWord="password"; tenantName="tenant"; commande="curl -X POST -H \"Content-Type: application/json\" -H \"Cache-Control: no-cache\" -H \"Postman-Token: 111131da-8254-21b3-1b95-9c12954152c9\" -d '{\"auth\":{\"tenantName\":\"$tenantName\",\"passwordCredentials\": {\"username\":\"$userName\",\"password\":\"$passWord\"}}}' \"http://controller:5000/v2.0/tokens\""
When the output of the variable commande is copy pasted into the shell it works, but when i use :
res= $(eval $commande) #or res=`$commande`
Neither one of those commands works, and this is the output error i usually get:
line 11: {"access":: command not found
PS: If i do
echo $comande$commande
And then i copy past the result on the shell it works,If anyone can help me that would be great !