#!/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 19529 2360 19529 2360 \_ /usr/bin/perl -w ./964597.pl 19531 19529 19529 2360 \_ ps Tf -o pid,ppid,pgrp,sid,cmd 19533 1 19530 2360 sleep 20 PID: 19530 PGRP: -1 PID PPID PGRP SID CMD 2360 2358 2360 2360 bash -rcfile .bashrc 19529 2360 19529 2360 \_ /usr/bin/perl -w ./964597.pl 19534 19529 19529 2360 \_ ps Tf -o pid,ppid,pgrp,sid,cmd 19533 1 19530 2360 sleep 20