#!/usr/bin/perl use warnings; use strict; use Proc::ProcessTable; my $time = time(); my $pid; my $pid1 = open(PH,"| xterm -T $time -e bash"); print "pidinit $pid1\n"; sleep 1; for my $p (@{new Proc::ProcessTable->table}){ if($p->ppid == $pid1){ $pid = $p->pid; } } print "$pid\n"; open(FH,">/proc/$pid/fd/1") or warn $!; for(1..1000){print STDOUT $_,"\n"; print FH $_.'a',"\n";sleep 1;} close FH;