I am trying to get some data as below. The problem I face is that if I run the curl command in shell as it is below, this works perfect, however if I run the
Works
curl -u blauser:blapsss "https://example.com" -d'[{ "name": "bla", "newname": "blagain"}]'
Does not work in script
getdata() {
url=$1
curl -u blauser:blapass $url
}
myurl="http://mynewurl/something" -d'[{ "name": "bla", "newname": "blagain"}]'"
getdata "$myurl"
Of course I did try to escape the quotes, square brackets etc. The problem I feel is somewhere around the place where I set the variable myurl="http://mynewurl/something" -d'[{ "name": "bla", "newname": "blagain"}]'"
The error I get is curl bad range specification in url position xx