Re: bash quoting



On 2008-02-07, jergendutch@xxxxxxxxx <jergendutch@xxxxxxxxx> wrote:


Hello,
I would like to run:
wget --header='Key: value' http://HOST/path
for three hosts.

I have a loop:

for i in one two three; do
wget --header='Key: value' http://$i/path
done

The path is really long, so I tidied it up:
WGET="wget --header='Key: value'"

for i in one two three; do
$WGET http://$i/path
done

This doesn't do what I expected: it also tries to fetch "Key: " as if
it is a url.
Using set -x shows me that the 'Key: value' gets split into two on the
space.
No combination of backslashes or different quotes seems to fix this.

What am I doing wrong?

Thanks.

eval $WGET http://$i/path
.



Relevant Pages

  • Re: wget problem
    ... 'fraid not - the names are stored somewhere on the site and added as a ... mkdir /tmp/blubb ... Maybe you can also try the --spider option of wget. ...
    (Fedora)
  • bash quoting
    ... wget --header='Key: value' http://HOST/path ... for three hosts. ... I have a loop: ... No combination of backslashes or different quotes seems to fix this. ...
    (comp.os.linux.misc)
  • Re: Signals and system
    ... I am using system to run wget. ... > in a loop, so that it will try all the mirrors while wget is exiting ... any reason you cannot use urllib2 with a socket timeout ...
    (comp.lang.python)
  • Re: Shell script help with wget and directory creation
    ... I am trying to create a shell script that will do the following: ... loop through a list and use wget to download a page from ...
    (comp.unix.shell)
  • Re: Shell script help with wget and directory creation
    ... loop through a list and use wget to download a page from ... You can open the second file on file descriptor 3; ...
    (comp.unix.shell)