Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ksh -p
- process=$1
- # if $1 is all numbers, then assume it's a PID, and get the parent process.
- if [[ $process = +([0-9]) ]]; then
- for pid in $( ptree $process | grep '^[0-9]' | awk '{print $1}' ); do
- pfiles $pid | egrep "^$pid:|sockname"
- done
- else
- # if $1 is/has letters, then assume it's a process name, and grep accordingly.
- for pid in $( ptree | grep $process | grep '^[0-9]' | awk '{print $1}' ); do
- pfiles $pid | egrep "^$pid:|sockname"
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement