#!/bin/bash
# Name: pidofp
# Author and Copyright: Brendan Hide (http://swiftspirit.co.za/)
# Release Version: 0.2 (2009-03-17)
# TODO: multiple parent-of-check; verbose output format options

if [ $# -gt "0" ]
 then
  for i in `pidof $1` ; do
   cat /proc/$i/status | grep PPid | awk '{printf $2} {printf " "}'
  done
  echo
 else
  echo "pidofp : print the a parent \$PID"
  echo "Usage: pidofp program"
  echo " See also: pidof"
fi
