Issue
So I am trying to accomplish a string substitution but is not working for me. This is my bash script so far:
d=1
message=('{"message":$d}')
echo $message
But the output is
{"message":$d}
I know the reason is because of the single quotes surrounding the {} but that is required for my purposes. Is there any workaround for this?
Solution
You can do this like that:
$ d=1
$ message='{"message":'"$d"'}'
$ echo "$message"
{"message":1}
Answered By - Arkadiusz Drabczyk