I am having bash code like below
'payload={"text": "failure with ${VAR} failed for"}'
but the variable is not resolving to actual value Please don't put negative as I don't have that much experience in Bash so.
CodePudding user response:
Variables don't expand in single quotes, which means that you simply have to ensure that they are not single-quoted. You have several possibilities, for instance:
'payload={"text": "failure with '"${VAR}"' failed for"}'
or
"payload={\"text\": \"failure with ${VAR} failed for\"}"
CodePudding user response:
You can concatenate variables directly.
'payload={"text": "failure with '${VAR}' failed for"}'