I'm trying to do some API REST requests with the curl loop command below. With a first list of URL (with REST request inside), this works perfectly, with a second one I get "curl: (3) Illegal characters found in URL"
for i in `rest_a_url_list` ; do curl -H "Content-Type: application/json" -H "Auth-Token: $token" $i ; done
I also tried to put the curl loop output in a bash script and "bash -x myfile.sh" and got also an illegal char error. But when I cat my file and copy some lines to exec it works.
Bash -x output give some simple quotes in place of doubles and place a '$' just before url curl -D -H -X GET -H 'Content-Type: application/json' -H 'Auth-Token: $token' $'url'
I tested several times and always the result. Perhaps onather way to achieve this but all that is starting to confuse me. Any thoughts what wrong I am doing?