Bruno oliveira wrote: > > Hi! Hello,
> Thanks for answer my question. The only reason why i > didn't want to use fork is that then i must by some > process (writing a file, opening a socket, ...), send > back the pid to the parent process, right ? fork returns the PID of the child in the parent process and returns zero in the child process. That is how you know whether you are in the child or the parent. In Perl, fork also returns undef if fork did not work. defined( my $pid = fork ) or die "Cannot fork: $!"; # gets the PID from fork if successful or die if $pid == undef if ( $pid ) { # is $pid not equal to zero? # now in the parent process sleep 60; # sleep for a minute kill 'TERM', $pid; # kill the child process } else { # $pid is equal to zero # now in the child process # replace the current process with 'top' exec 'top' or die "Cannot exec 'top': $!"; print "This will never print!\n"; } print "Still in parent.\n"; print "exec()ed and kill()ed PID: $pid\n"; John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]