#!/bin/sh
# children
#ps axl | sed 1d | awk '
if [ ! $# -eq 1 ]
then
        echo "${0}: Displays the children processes of a PID"
        echo "Usage: $0 Process_id"
        exit
fi
ps -ef | sed 1d | awk '
BEGIN {
                p = 0
                parent[p++] = pid
}

{
                for (i = 0; i < p; i++)
                {
                        if (parent[i] == $3)
                        {
                                parent[p++] = $2
                                print "proc " $2 " parent " $3
                                break
                        }
                }
                next
}' pid=$1
