Skip to content

Instantly share code, notes, and snippets.

@mjf
Created March 9, 2012 10:43
Show Gist options
  • Save mjf/2006042 to your computer and use it in GitHub Desktop.
Save mjf/2006042 to your computer and use it in GitHub Desktop.
PT - Trace process ID up in the process tree
#! /bin/sh
# PT - Trace process ID up in the process tree
# Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
if [ $# -ne 1 ]
then
echo usage: pt pid
exit
fi
if [ $1 -lt 1 ]
then
exit
fi
if ps -o pid= -p $1
then
$0 `ps -o ppid= -p $1`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment