Bash child proccess PID - how do you get it?

Posted by Jason Tan on Server Fault See other posts from Server Fault or by Jason Tan
Published on 2011-01-14T12:13:51Z Indexed on 2011/01/14 12:54 UTC
Read the original article Hit count: 284

Filed under:
|

Can any one tell me how to get the PID of a command executed in bash.

E.g. I have a bash script that runs imapsync.

When the script is killed the imapsync process does not always get killed, so I'd like to be able to identify the PID of imapsync programatically from my script, so that I can kill the imapsync process myself in a signal handler.

So how do I programatically get the PID of a child process from a parent bash script?

Thanks Folks

© Server Fault or respective owner

Related posts about bash

Related posts about pid