Kuang He wrote:
2005/4/15, Robert Vangel <robert@vangelr.net.au>:Using " should work, or if you want a literal " you would use \" but this would break it...Using " works most of the time, but, if you encouter some URL like http://bbs.ustc.edu.cn/cgi/sf?bid=260&aof=M425dea7e&fn=23.jpgIt does not work properly.
The fact is that you must convice bash to pass the url to wget without modification.
Let's see a few examples [oesser@logic-pc1 ~]$ a="hello" [oesser@logic-pc1 ~]$ echo "$a" helloHowever the expansion is done only once; characters inside the variable a itself is not expanded anymore:
[oesser@logic-pc1 ~]$ hello="good morning" [oesser@logic-pc1 ~]$ a='$hello' # character inside single quote are # not expanded [oesser@logic-pc1 ~]$ echo "$a" # expand the variable $a but once # it is done do not try to expands # the variable $hello $helloSo if you use "$1" it will work whatever characters are present in $1. But if you use a URL directly written on the command line, not stored in a variable; you must enclose it in single quote to prevent expansion of "variables" which might be present in the URL.
Olive