in reply to How do I get the process ID from a system("x &") call?
bash allows this:
perl test.pl & jobs -nl > out.txt
out.txt will contain a line like:
[2]+ 27872 Running perl test.pl &
You can call it from Perl using (untested) (see update):
open (FILE, "perl test.pl & jobs -nl |");
update: I had to use this in order to make it work:
open (FILE, "perl test.pl & jobs -nl | cat |");
update: don't use this. It is not portable. Use fork instead - see below.
|
|---|