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

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


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