Problem Using Variables In CURL
Hi, I need some help using variables in CURL.
Here's my code: transfer_to_pcid="AAAAAAAA" transfer_from_pcid="BBBBBBBB" basic_password=`ssh rsync@some_test_domain 'curl --silent "http://some_test_domain/insite_com/qs2_pwd_insite_basic.asp?ST=New&PC="$transfer_from_pcid"&TP="$transfer_to_pcid"&VT=7.4"'` ; When the command runs the variables don't seem to be getting passed to the asp page. Any help would be appreciated. |
The curl command is enclosed in single-quotes, which disables the special meanings of all other characters, including " (and of course $). You can either "un-enclose" the variables (and re-enclose them in double-quotes if necessary), or else use double-quotes on the outside, and escape the internal double-quotes.
Code:
basic_password=$(ssh rsync@some_test_domain 'curl --silent "http://some_test_domain/insite_com/qs2_pwd_insite_basic.asp?ST=New&PC='"$transfer_from_pcid"'&TP='"$transfer_to_pcid"'&VT=7.4"') Note also that $(..) is preferred over `..`. PS: Please use [code][/code] tags around your code, to help preserve formatting and to improve readability. |
Thanks a lot. It worked fine.
|
All times are GMT -5. The time now is 11:55 PM. |