my $ppid = getppid; my $ppdescrip = `ps -p $ppid`; my ( $shell_name ) = ( $ppdescrip =~ /(\S+)\s*$/ ); # shell name is last word in the output of "ps -p pid"