I'm trying to send data in a curl including new lines (from a git log) and bash just expands the new lines. I want them to literally be in the string when I use the environment var:
STR="Hello\nWorld"
echo $STR
Is currently giving me:
Hello
World
I want it to give me:
Hello\nWorld
My actual use-case:
function notify() {
export RELEASE_NOTES=`git log $(git describe --tags --abbrev=0)..HEAD --no-merges --oneline --pretty=tformat:"%s [%cn]"`
if [[ $SLACK_WEBHOOK_URL ]]; then
curl -X POST -H 'Content-type: application/json' --data '{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Notes*:\n ```'$RELEASE_NOTES'```"
}
}
]
}' $SLACK_WEBHOOK_URL
fi
}