perdana
perdana

Reputation: 51

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.

Upvotes: 5

Views: 27687

Answers (3)

Fatimh
Fatimh

Reputation: 11

if you are using a jubyter notebook, maybe check if you have downloaded

pip install wget 

before warping from URL

Upvotes: 0

yan
yan

Reputation: 20982

Wrap your URL in single quotes to avoid this issue.

i.e.

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

Upvotes: 9

Anders Lindahl
Anders Lindahl

Reputation: 42870

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.

Upvotes: 16

Related Questions