After 30mins of futile attempt to capture the output of wget
, I figured out that the program writes to stderr
rather than the stdout
. Searching in web and stack-overflow reveals this to be a well-known fact.
Any idea why is this so?
It's well known, because it's in the manual.
Reporting messages on stderr
is common, because messages are separated from regular output on stdout
. This is useful when you combine several tools with a pipe. In this case it would be bad, when regular output and diagnostic messages were mixed up.