pid

D

Degz

Hi Sam,

If you want the process ID of your script, then I believe you want
print "My PID = $$ \n";

Regards
Degz
 
P

Paul Lalli

bsder said:
I want to print a child process ID, not a script id.

Then why didn't you say that to begin with?

my $pid = fork();
if ($pid){
#in parent
print "Child's PID: $pid\n";
} else {
#in child
exec ('child_process.pl');
}

perldoc -f fork
perldoc -f wait
perldoc perlipc

Paul Lalli
 
J

Jürgen Exner

bsder said:
I want to print a child process ID, not a script id.

Then why on earth didn't you say so to begin with but lead us on a wild
goose chase?

perldoc -f print
perldoc -f fork (oay particular attention to the return value of fork)

jue
 
B

bsder

Paul said:
Then why didn't you say that to begin with?

my $pid = fork();
if ($pid){
#in parent
print "Child's PID: $pid\n";
} else {
#in child
exec ('child_process.pl');
}

perldoc -f fork
perldoc -f wait
perldoc perlipc

Paul Lalli
Thanks for the hints. Is there other way I can print the pid of the
current process?

Thanks
Sam
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,159
Latest member
SweetCalmCBDGummies
Top