fork returns the pid of the child in the parent.
my $cpid; { defined($cpid = fork) or die $!; $cpid and last; # do child stuff and exit. # exec is good here } # parent goes on, knowing $cpid
exec replaces the current program, taking over its pid and never returning.
After Compline,
Zaxo
In reply to Re: Executing a process in the background AND getting its pid
by Zaxo
in thread Executing a process in the background AND getting its pid
by henrikbe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |