title: Using while or until to wait until a PID doesn't exist
body: <p>I have been using Bash to wait until a PID no longer exists. I've tried</p>
  
  <pre><code>#!/bin/bash
  while [ kill -0 PID &gt; /dev/null 2&gt;&amp;1 ]; do
      //code to kill process
  done
  //code to execute after process is dead
  </code></pre>
  
  <p>as well as</p>
  
  <pre><code>#!/bin/bash
  until [ ! kill -0 PID &gt; /dev/null 2&gt;&amp;1 ]; do
      //code to kill process
  done
  //code to execute after process is dead
  </code></pre>
  
  <p>Both these examples either fail to work, or keep on looping after the process has ended. What am I doing incorrectly?</p>