-4

I was wondering why the following command fails to download a pdf file, while pasting the URL in browser's address bar can? (I am trying to learn a little about HTTP, web services, or web applications from this question)

How shall I use wget to download the pdf file?

Thanks.

$ wget https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.598&rep=rep1&type=pdf
[1] 5696
[2] 5697

Redirecting output to ‘wget-log.1’.
[2]+  Done                    rep=rep1

$ cat wget-log
--2019-11-25 13:30:42--  https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.598
Resolving citeseerx.ist.psu.edu (citeseerx.ist.psu.edu)... 130.203.136.95
Connecting to citeseerx.ist.psu.edu (citeseerx.ist.psu.edu)|130.203.136.95|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5641 (5.5K) [text/html]
Saving to: ‘download?doi=10.1.1.99.598’

download?doi=10.1.1.99.598                   100%[============================================================================================>]   5.51K  --.-KB/s    in 0s      

2019-11-25 13:30:42 (453 MB/s) - ‘download?doi=10.1.1.99.598’ saved [5641/5641]

[1]+  Done                    wget https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.598
Paulo Tomé
  • 3,782
Tim
  • 101,790
  • One possible duplicate: https://unix.stackexchange.com/questions/280645/accessing-google-translate-via-wget/280649#280649 also https://unix.stackexchange.com/a/213004/117549 and https://unix.stackexchange.com/q/241538/117549 – Jeff Schaller Nov 25 '19 at 18:53

1 Answers1

4

It looks like your shell is interpreting the & characters in the URL and they are not getting to wget.

You should single quote the string, so your shell treats the whole thing as one string and does not try to interpret special characters:

wget 'https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.99.598&rep=rep1&type=pdf'