#!/usr/bin/perl -w use strict; sub ps { system "ps Tf -o pid,ppid,pgrp,sid,cmd"; } $SIG{CHLD} = 'IGNORE'; my $snoop = fork(); if ( $snoop == 0 ){ setpgrp; system("sleep 20 ;"); exit; } ps(); sleep 1; print "PID: $snoop\n"; printf "PGRP: %d\n", getpgrp($snoop); kill -1, getpgrp($snoop); ps(); __END__ PID PPID PGRP SID CMD 2360 2358 2360 2360 bash -rcfile .bashrc 19537 2360 19537 2360 \_ /usr/bin/perl -w ./964597.pl 19538 19537 19538 2360 \_ /usr/bin/perl -w ./964597.pl 19540 19538 19538 2360 | \_ sh -c sleep 20 ; 19541 19540 19538 2360 | \_ sleep 20 19539 19537 19537 2360 \_ ps Tf -o pid,ppid,pgrp,sid,cmd PID: 19538 PGRP: 19538 PID PPID PGRP SID CMD 2360 2358 2360 2360 bash -rcfile .bashrc 19537 2360 19537 2360 \_ /usr/bin/perl -w ./964597.pl 19542 19537 19537 2360 \_ ps Tf -o pid,ppid,pgrp,sid,cmd