The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-14-2004
zazzybob's Avatar
zazzybob zazzybob is offline
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Use wc -l to count the lines of the output

i.e.
Code:
if [ $( ps -ef | grep wtrs | wc -l ) -gt "3" ];
then
   # do stuff for more than 3 lines
else
   # do stuff for three or less lines
fi
peace,
ZB
http://www.zazzybob.com
Reply With Quote