Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] script question


On Mon, Jul 30, 2001 at 01:50:03PM +1000, Bernhard Luder (bl@xxxxxxxxxxx) wrote:
> No, that's not what I mean. I know grep -v will match everything but.
> 
> What I need is:
> if [a log file] does not contain "0% packet loss" specifically then do
> something (eg. restart interface) otherwise do nothing.
> 
> I have no idea how to express this in a command. How will I get a command
> executed, if the log file does not contain "0% packet loss" specifically?


grep "0% packet loss" /var/log/messages && {echo "I found it"; somecommand;} || {echo "didnt find it"; someothercommand;}


-> man bash



jobst






-- 
People who fight may lose. People who do not fight have already lost.  - Bertolt Brecht

             __, Jobst Schmalenbach, jobst@xxxxxxxxxxxxxx, Technical Director
   _ _.--'-n_/   Barrett Consulting Group P/L & The Meditation Room P/L      
 -(_)------(_)=  +61 3 9532 7677, POBox 277, Caulfield South, 3162, Australia