#!/bin/sh echo "father pid $PPID" grandpaPid=`ps -f $PPID | awk '{if (NR==2) print $3}'` echo "grandpa pid $grandpaPid" grandpaName=`head -n 1 /proc/$grandpaPid/status | awk '{print $2}'` echo "my grandPa Name : <$grandpaName>"