[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] Errors-only mode
From: |
Tim Rühsen |
Subject: |
Re: [Bug-wget] Errors-only mode |
Date: |
Thu, 10 Aug 2017 12:52:03 +0200 |
User-agent: |
KMail/5.2.3 (Linux/4.11.0-2-amd64; KDE/5.28.0; x86_64; ; ) |
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
signature.asc
Description: This is a digitally signed message part.