The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 07-03-2002
Perderabo's Avatar
Perderabo Perderabo is offline
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,354
For a list of pid's that are not owned by root but have a ppid of 1, I would go with:
Code:
#! /usr/bin/ksh
ps -ef | sed 1d | while read user pid ppid junk ; do
      if [[ $user != root && $ppid = 1 ]] ; then
            echo $pid
      fi
done
exit 0