bash wget script problem

bash wget script problem

Nadav Har'El nyh at math.technion.ac.il
Mon May 7 16:21:19 IDT 2012


On Sun, May 06, 2012, vordoo wrote about "Re: bash wget script problem":
> wget -O - http://admin:1234@192.168.1.1/Status_Router.asp => bash:
> 1234 at 192.168.1.1/Status_Router.asp: event not found

I think we're missing something here - maybe you didn't actually write
1234, but a password containing an exclamation point ("!")? 
The "event not found" suggests there is an explanation point: Look at
this:

$ bash
$ echo hi!hello
bash: !hello: event not found
$ echo "hi!hello"
bash: !hello": event not found
$ echo hi\!hello
hi!hello
$ password="hi!hello"
bash: !hello": event not found
$ password="hi\!hello"
$ echo $password
hi\!hello

So, as you can see, bash sucks seriously in this regard - it forces you
to quote the "!", but then you are left with that quote...

The good news, is that this suckiness only happens for interactive
shells, not in shell scripts. In an interactive shell, you can use "set +H"
to disable this behavior:

$ set +H
$ password="hi!hello"
$ echo $password
hi!hello

-- 
Nadav Har'El                        |                     Monday, May 7 2012, 
nyh at math.technion.ac.il             |-----------------------------------------
Phone +972-523-790466, ICQ 13349191 |"Outlook not so good." Wow! That magic 8-
http://nadav.harel.org.il           |ball knows everything! So, what about IE?



More information about the Linux-il mailing list