How can I have wget print errors, but nothing otherwise?
In the default behavior, it shows a progress bar and lots of stuff.
In the --no-verbose version still prints one line per downloaded file, this I don't want.
The --quiet option causes it to be totally quiet, even in the case of an error, it doesn't print anything.
Is there a mode in which it prints errors, but nothing else?
There are very good answers in this question, be sure to check them out, but what I've done is this:
Use curl, no point guessing what every error will look like.
And if you need stderr on stdout for some reason.
I don't see an option for that. Do you need to know what the error is, or just if it happened? If you happen to just need to know if there was error, you can use the exit status.
Or, maybe:
And you can change the cat to a grep command if you want to get fancy...
works. But it always truncates the output file, which you may or may not want.
Curl is better:
In case of an error it does not modify the output file.
Redirect standard output to
/dev/null
, but keep the error output in your choice of shell.In bash this would be:
Edit: So
wget
misbehaves. If all errors contain the word "error" in them you could pipe togrep
Since
wget
outputs all messages onstderr
, you have to use redirection before you can pipe it to grep:This assumes that
wget
begins its error lines with "wget:".