I am trying to execute curl commands from my shell script on OSx el Capitan.
How can i pass a variable to the curl script. I tried this:
var ="some variable"
curl -O '$var'
But its not working. Thanks in advance
1 Answer
Single quotes may be preventing interpolation of the variable. Try this as a sample:
export var="http://www.google.com/"
curl "$var"
3 Comments
kshitij Nigam
My bad am using a bunch of data not just the url so its curl -O --data 'random data=$var& some other data'
Phillip Mills
It's the same problem, regardless. Your variable won't be interpolated inside single quotes; you need double ones to get anything except what you literally typed.
kshitij Nigam
Thanks a ton will try this
varand="some variable"in your script? And what does "its not working" mean?