#!/usr/bin/perl -w use strict; use Proc::ProcessTable; my $proc = Proc::ProcessTable->new; foreach (@{$proc->table}) { if ($_->pid eq getppid) { print "The parent pid is ", getppid, "\n"; print "The name of the parent shell is ", $_->cmndline, "\n"; }; };