![]() |
Need advanced shell scripting help
Hey all, I'm about to finish a really awesome shell script (not Maemo-related, but still very handy) but one last thing is holding it up. I need to run wget '$url' where the content of the $url variable is actually substituted, but the single quotes prevent that. So the command should be run like:
Code:
wget 'http://site.com/whatever.html' So what escape sequence can I use to make the contents of my variable come out between single quotes? Give me a working answer and I can share my handy script! :D |
Re: Need advanced shell scripting help
Eh... Just a man entry...
Quote:
|
Re: Need advanced shell scripting help
result=`wget \'${url}\'`
echo ${result} :confused: |
Re: Need advanced shell scripting help
Quote:
|
Re: Need advanced shell scripting help
Quote:
I assume the URL in question contains "interesting" characters which cause some breakage when used with double quotes on the command line. Have you tried using wget -i instead? |
Re: Need advanced shell scripting help
Quote:
http://www.planetmike.com/2005/04/12/wget-and-urls-with-ampersands/ I'll give wget -i a try, but putting the URLs in a file would be highly impractical...this script iterates through a list of URLs using cut. |
Re: Need advanced shell scripting help
Quote:
Anyway something like: Code:
URL="http://www.example.com/some web page.php?a=1&b=2&c=3" |
Re: Need advanced shell scripting help
I fixed the URL and I'm now working on the script...
|
Re: Need advanced shell scripting help
Quote:
Code:
$ wget -nv "http://talk.maemo.org/attachment.php?attachmentid=16109&d=1291329691" Quote:
Code:
$ long-pipeline-using-cut | wget -i - |
Re: Need advanced shell scripting help
WOOHOO Success! I had one other problem but wget "${URL}" did the trick! :D
Stand by for sweet script! :cool: |
All times are GMT. The time now is 14:27. |
vBulletin® Version 3.8.8