#!/usr/bin/perl use strict; use warnings; use Proc::ProcessTable; my $proc = Proc::ProcessTable->new(); my ($own)=grep{$$==$_->{pid}}@{$proc->table()}; my ($upper)=grep{$own->{ppid}==$_->{pid}}@{$proc->table()}; if($upper->{fname} eq 'su') { print "running throu 'su' \n"; } else { print "running normal\n"; }