in reply to What shell am I running?

As others have already pointed out, this code isn't overly portable because of the dependency on the output of ps. A better solution would be to make use of Proc::ProcessTable which I have reviewed previously here. eg.

#!/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"; }; };

 

Ooohhh, Rob no beer function well without!