myCommand & echo $!
$$ is the current script’s pid
$! is the pid of the last background process
References
http://stackoverflow.com/questions/1908610/how-to-get-pid-of-background-process
http://serverfault.com/questions/205498/how-to-get-pid-of-just-started-process