I'm trying to replace 1.2.3.4 with the contents of variable $wanip in the following script.
wanip="4.3.2.1"
echo $wanip
content=$(curl --insecure -H "X-DNSimple-Token: foo:bar" -H "Accept: application/json" -H "Content-Type: application/json" -X PUT -d "{\"record\": {\"name\": \"foo\",\"content\": \"1.2.3.4\"}}" https://acme.com/records/123)
echo $content
If I literally replace 1.2.3.4 with $wanip*, when I run the script I'm getting a message saying: "message":"Problems parsing JSON".
set -xbefore the command (andset +xafter). It should print++ curl --insecure -H 'X-DNSimple-Token: foo:bar' -H 'Accept: application/json' -H 'Content-Type: application/json' -X PUT -d '{"record": {"name": "foo","content": "4.3.2.1"}}' https://acme.com/records/123-- if it prints something else, that may point to the problem.cat -vt scriptname, and see if it lists "^M" at the end of lines. If it does, use something likedos2unixorsed -i $'s/\r$//' scriptnameto fix it, and then stay away from Windows text editors for unix scripts.