in reply to Parent process name
On my Linux box it outputs the following:#!/usr/bin/perl use strict; use warnings; my $parent_id; foreach (`ps -ef`) { my ($uid,$pid,$ppid) = split; next unless ($pid eq $$); $parent_id = $ppid; last; } my $parent = (grep {/^\s*\d+/} (`ps -p $parent_id`))[0]; my $parent_name = (split /\s+/, $parent, 5)[4]; print $parent_name;
$ ./parent-process.pl bash $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Parent process name
by deibyz (Hermit) on May 28, 2004 at 15:08 UTC | |
by Anonymous Monk on Jun 03, 2013 at 15:12 UTC | |
by gsiems (Deacon) on May 28, 2004 at 16:55 UTC | |
by meetraz (Hermit) on May 28, 2004 at 19:06 UTC |