- To: slug@xxxxxxxxxxx
- Subject: [SLUG] Re: script question - SOLVED
- From: Angus Lees <gusl@xxxxxxxxxxxxxxx>
- Date: Wed Aug 1 11:55:05 2001
- User-agent: Mutt/1.2.5i
\begin{Bernhard Luder}
> Thanks everyone for their help. Your answers brought me a huge step forward
> in the effective automation on my network.
>
> I ended up using something along the lines of (Thanks Rick and Russell):
>
> if ! grep "0\% packet loss" file; then command; fi
1. if you're only interested in the exit status, not the actual
matching lines, use "grep -q". no point searching the entire file
when the first line matches.
2. use "grep -q '0% packet loss' || command". its a very common idiom
in shell scripting, you'll see it all over the place. shell is not
C, the quicker you embrace its differences, the sunnier life will
be.
--
- Gus.terse