0

When I run this command it works as expected:

wget -p https://www.google.com/

After running this command I check the error code with

echo $?

This returns 0, indicating that last command ran without experiencing any errors.

Now I run:

wget -p https://www.google.com/ >/dev/null

This last command should suppress standard output- but it doesn't. So what is going on? This almost seems particular to wget, because I've never had an issue piping standard output before with other commands.

It's also worth noting that if you run:

wget -p https://www.google.com/ 2>/dev/null

all output is suppressed. Would someone care to enlighten a confused human?

6

Well, wget -p https://www.google.com/ &> /dev/null is working. That is because wget output to stderr instead of stdout. You could check wget manual.

‘--output-file=logfile’

Log all messages to logfile. The messages are normally reported to standard error.

| improve this answer | |
  • 2
    Or just use -q. – Sammitch Dec 29 '17 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.