title: Return status of command returning data into variable
body: <p>how can I get status from command, which is assigned into variable? </p>
  
  <p>For example:</p>
  
  <pre><code>#! /bin/bash
  
  ### GET PID
  GETPID=$(ps aux | grep "bash" | grep -v "grep" | awk '{print $2 }')
  
  if [ "$?" = "0" ]; then
      echo "status OK"
  else 
      echo "status NOT OK"
  fi
  </code></pre>