[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: [rhelv5-list] Regular Expressions on RHEL 5



I don't think the intention of the script writer was to throw out
stderr, it was to throw out stdout and KEEP stderr. In that case, there
is nothing "in the wrong place" as the syntax used is what is required
to achieve the desired results.

Likely you are right about your suggestion, but it could be that they
want to exit only in the specific cases mentioned...

Kevin

-----Original Message-----
From: rhelv5-list-bounces redhat com
[mailto:rhelv5-list-bounces redhat com] On Behalf Of Edward F. Brown
Sent: Saturday, December 29, 2007 9:07 AM
To: Red Hat Enterprise Linux 5 (Tikanga) discussion mailing-list
Subject: Re: [rhelv5-list] Regular Expressions on RHEL 5

>> What it IS doing is sending stderr to stdout and then sending stdout
to
>> the bit bucket. So, you are ONLY seeing the error output of this
>> command. In this case, its must be what you want - you only care when
>> there is an error.

>>>> wget $WGETOPTS ${URL}/${FNAME} 2>&1 >/dev/null | egrep -q '[Nn]ot
>>> (retrieving|Found)' && exit
>>> but what do you think this does  ^^^^^^^^^^^^^^^


If standard error were going to stdout, and stdout to the bit bucket,
then
all output would be thrown away and egrep would never see anything to
match.

The redirection of standard error, '2>&1', luckily for the script
writer,
is in the wrong place.  You have to do '>/dev/null 2>&1' for stderr to
actually be thrown away along with stdout.

As it is, neither redirection is serving any purpose, since it seems all
of wget's verbosity is to standard error.  A simpler approach might be
to
tell wget to be quiet, and exit on any error:

wget -q -N --no-check-certificate ${URL}/${FNAME} || exit

-Ed

_______________________________________________
rhelv5-list mailing list
rhelv5-list redhat com
https://www.redhat.com/mailman/listinfo/rhelv5-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]