title: Bash : Check if PID exists with further logic
body: <p><strong>Question:</strong> How do you check if a PID exists and use the result within an IF statement in bash?</p>
  
  <p><strong>Things I've tried</strong></p>
  
  <pre><code>if [ "$(ps -p $pid)" -eq 0 ]; then 
   echo "Running"
  else
   echo "Not Running"
  fi
  </code></pre>
  
  <hr>
  
  <pre><code>if [ "$(kill -0 $pid)" -eq 0 ]; then 
   echo "Running"
  else
   echo "Not Running"
  fi
  </code></pre>
  
  <p><strong>Neither of these evaluate correctly no matter how I redirect STDOUT/STDER</strong> </p>