title: kill & wait in one step
body: <p>If I use a combination to kill a child process in batch and wait for it's termination, I use</p>
  
  <pre><code>kill $PID
  wait $PID
  </code></pre>
  
  <p>If the process exists immediately, the <code>wait</code> will fail, since the pid is not running anymore.</p>
  
  <p>Is there a way to combine both statements to a single one to aviod the error?</p>
  
  <p>Edit: The process I have to kill uses a tempfile; thus it has to be closed (and not just signaled to close) to start it again. Checking the return value of <code>kill</code> does not help, since this indicates whether the signal was delivered successfully.</p>