Skip to content

Instantly share code, notes, and snippets.

@schallis
Created August 14, 2011 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schallis/1144981 to your computer and use it in GitHub Desktop.
Save schallis/1144981 to your computer and use it in GitHub Desktop.
A Portable Bash Function to List Process Hierarchies
parents(){ :(){
read p n <<<`ps -o ppid,comm -p $1 | awk 'NR>1{print $1,$2}'`;
echo -e "$1\t$n";
test $1 -ne 0 && : $p; };
: $1; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment