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

2022-01-24 00:00:00 wget syntax save html

我对 wget 很陌生,我在 Google 上进行了研究,但没有发现任何线索.

I am quite new with wget and I have done my research on Google but I found no clue.

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

I need to save a single HTML file of a webpage:

wget yahoo.com -O test.html

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

and it works, but, when I try to be more specific:

wget http://search.yahoo.com/404handler?src=search&p=food+delicious -O test.html

问题来了,wget&p=food+delicious 识别为语法,它说:'p' is not Recognized as an internal或外部命令

here comes the problem, wget recognizes &p=food+delicious as a syntax, it says: 'p' is not recognized as an internal or external command

我该如何解决这个问题?非常感谢您的建议.

How can I solve this problem? I really appreciate your suggestions.

推荐答案

&在shell中有特殊含义.使用 对其进行转义或将 url 放在引号中以避免此问题.

The & has a special meaning in the shell. Escape it with or put the url in quotes to avoid this problem.

wget http://search.yahoo.com/404handler?src=search&p=food+delicious -O test.html

wget "http://search.yahoo.com/404handler?src=search&p=food+delicious" -O test.html

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

In many Unix shells, putting an & after a command causes it to be executed in the background.

相关文章