Wednesday, 13 July 2016

How to include environment variable in CURL?

When you post a string(json) by curl and you want to include your environment variables in to the string like this:
{
   "username": "$HOST_NAME".
}
What you expect to see is username = "Peter MacAir" on your server side.

But it shows this username=$HOST_NAME on your server side

Solution:

'"$HOST_NAME"'

curl
-X POST
--data-urlencode
'payload={"channel": "#testgroup",
"username": "'"$HOST_NAME"'",
"text": "'"$APK_NAME"' is ready."}'
https://hooks.slack.com/services/xxx/xxx/ffff





No comments:

Post a comment