The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 08-30-2007
dhams dhams is offline
Registered User
  
 

Join Date: Aug 2007
Posts: 12
child pid in ZSH

I am using ZSH shell in Linux.

I am calling a child program in background mode parallely (say 2-3 threads). I have problem in handling the temporary files of these child programs since the temp file names are unique for all the child process.

To distinguish i want to use the pid in the temp files. But when I use the $$ to fetch the pid it is same across all the chils process since the obtained pid is of the master program which called all these.

Could anyone help me to identify the PID of the current child process so taht i cann append in the temp file names. From the previos threads i saw there is a function called getpid() to get the pid. But am not sure of the usage..