1 #!/bin/bash
2 pid=$1
3 if [ -f "/proc/$pid/stat" ]; then
4 name=`cat /proc/$pid/stat | cut -d" " -f 2`
5 else
6 echo "Not a Valid pid $pid"
7 exit
8 fi
9
10
11 while [ "$pid" -gt "0" ]; do
12 echo -n $pid
13 echo -n [$name]
14 echo -n " --> "
15 name=`cat /proc/$pid/stat | cut -d" " -f 2`
16 pid=`cat /proc/$pid/stat | cut -d" " -f 4`
17 done
18
19 echo "0"
20
-Vaibhav
1 comment:
good post
Post a Comment