Re: grep & egrep script problem

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

 



On 02Nov2006 08:45, Paul Ward <pnward@xxxxxxxxxxxxxx> wrote:
| # ps -fe| awk '{print $8}' | egrep "test1" -e "test2" |echo $?

Maybe this:

  out=`ps -fe| awk '{print $8}' | egrep "test1" | egrep "test2"`
  [ -n "$out" ]

If any lines get through both greps, $out will not be empty.
This we test for.

Note that this doesn't scale very well to lots of tests. You'll have to
do something more sophisticated for lots of tests.

Cheers,
-- 
Cameron Simpson <cs@xxxxxxxxxx> DoD#743
http://www.cskk.ezoshosting.com/cs/

Men are not hanged for stealing horses, but that horses may not be stolen.
        - Lord Halifax, Works


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux