On Mittwoch, 9. August 2017 22:08:12 CEST Dale R. Worley wrote:
> Is there a way of invoking wget that produces no output if the operation
> is successful (let's assuming that I'm fetching exactly one URL) and
> produces appropriate error messages if it is not?
> 
> I would have thought this was easy, but I can't figure out how to do
> it.  Even redirecting stdout to null doesn't work, since wget sends a
> final success message to stderr:

wget -o/dev/null URL

You can check for errors via the $? (on Linux, there should be something 
comparable on other systems).

$ wget -o/dev/null www.google.de
$ echo $?
0

$ wget -o/dev/null www.google.de/failure
$ echo $?
8

Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to