<<< Date Index >>>     <<< Thread Index >>>

Re: [OT] GNU Grep (was: Re: hook for not editing email)



Dave, et al --

All right, I'm just dying to understand this.

...and then David Yitzchak Cohen said...
% 
% On Fri, Jan 02, 2004 at 02:41:21PM +0100, Magnus Bäck wrote:
% 
% > Am I missing some subtle point? The -q option seems to be specific to
% > GNU grep, by the way.
% 
% Yeah, here's a more portable way to do it:
% if egrep -q '^Subject: .*<eom>$' $file >/dev/null 2>&1 ; then

If -q is specific to GNU then how is including it "more portable"?  I'd
think you should skip it entirely, which would also save you from having
to dump stderr since you wouldn't be throwing an error every time you ran
it.  I'm not positive (and I don't have a non-GNU system on which to try
it at the moment), but I wouldn't be surprised if the error changed the
exit code of egrep and thus botched the test anyway; it's worth checking.


% 
%  - Dave


HTH & HAND & Happy New Year!

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) davidtg@xxxxxxxxxxxxxxx * society and not sufficient moral courage.
(work) davidtgwork@xxxxxxxxxxxxxxx  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: pgphiMy9A81Vs.pgp
Description: PGP signature