Wget将我的URL地址的某些部分识别为语法错误

per*_*ana 5 html syntax wget save

我很陌生wget,我已经在Google上完成了我的研究,但我没有发现任何线索.

我需要保存网页的单个HTML文件:

wget yahoo.com -O test.html
Run Code Online (Sandbox Code Playgroud)

它有效,但是,当我试图更具体时:

wget http://search.yahoo.com/404handler?src=search&p=food+delicious -O test.html
Run Code Online (Sandbox Code Playgroud)

这就是问题所在,它wget被认为&p=food+delicious是一种语法,它说:'p' is not recognized as an internal or external command

我怎么解决这个问题?我非常感谢你的建议.

And*_*ahl 13

&有壳有特殊的含义.将其转义\或将url放在引号中以避免此问题.

wget http://search.yahoo.com/404handler?src=search\&p=food+delicious -O test.html
Run Code Online (Sandbox Code Playgroud)

要么

wget "http://search.yahoo.com/404handler?src=search&p=food+delicious" -O test.html
Run Code Online (Sandbox Code Playgroud)

在许多Unix shell中,放置&一个命令会导致它在后台执行.


yan*_*yan 8

将您的网址用单引号括起来以避免此问题.

wget 'http://search.yahoo.com/404handler?src=search&p=food+delicious' -O test.html
Run Code Online (Sandbox Code Playgroud)