-   Programming (
-   -   obtaining PID of shell script (

sanjith11 07-14-2004 11:33 AM

obtaining PID of shell script

How can i obtain the PID of a just started shell script.


Donboy 07-14-2004 11:38 AM

You can do ps -ef and look for the name of the program that's running. The PID will be shown in the second column, if memory serves.

See also:

Dark_Helmet 07-14-2004 11:41 AM

You can also have the script itself report the value. The shell variable $$ contains the pid. If you need to share that information with external programs/scripts, just output it to a file. Something like:

echo $$ > /tmp/

itsme86 07-14-2004 11:43 AM

From inside the script you can use $$ to obtain the PID (e.g. echo $$)

EDIT: AHH! DH beat me to it :)

All times are GMT -5. The time now is 05:57 AM.