title: Get process id of the command of the command just after execution
body: <p>I need to execute a couple of commands in Linux via python and store the process of the commands in database so I can kill it when it is needed. For each command I should get the process id and put it in to database when it is needed.</p>
  
  <p>I tried <code>command &amp; echo$!</code> this will return process id in output. I have to parse the output and get the process id. I need to know is there any easy way to get the process id after running a command?.</p>
  
  <p>Output of above command will </p>
  
  <pre><code>[1] 7543745
  
  command output
  -
  -
  -
  -
  -
  -
  -
  -
  -
  -
  </code></pre>