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?