wget -k -O- never returns

3

1

Does anyone know why

wget -O- http://www.google.com

and

wget -k http://www.google.com

work just fine, but

    wget -k -O- http://www.google.com

... never returns?

Using wget 1.12 under MacOS X and Debian

plang

Posted 2011-01-06T08:02:01.457

Reputation: 203

Answers

5

This call is somewhat nonsensical, because -k is for converting links relative to the local storage location, but with -O- you are not specifying a local storage location.

What actually appears to happen is that wget is attempting to look at the output file after having downloaded it, in order to apply the -k modifications, but the output is to the terminal, so it waits on the terminal. If you send an EOF on the terminal (press Ctrl+D), the call terminates. It obviously can't do anything with what you enter, because the output was already printed.

On might think that wget should detect this situation, but note that Unix utilities are generally device independent and quite happily wait on a terminal if you have somehow failed to supply input (compare grep).

Peter Eisentraut

Posted 2011-01-06T08:02:01.457

Reputation: 6 330

Hi Peter, I see you do not have only a deep understanding of Postgreql, but also of Unix too. Thanks for your reply! – plang – 2011-01-06T10:01:32.983