Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
238 views
in Technique[技术] by (71.8m points)

html - Wget recognizes some part of my URL address as a syntax error

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

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

or

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...