title: How to grep and then fail an if-statement on specific output from grep?
body: <p>Ok I need to find the output that a command gives, notely "gbak: ERROR" and then fail on it. I don't know if I'm going about it the right way, I tried to make if fail if the grep did an output to /dev/null but I couldn't get that working either (probably just poor syntax). I'm sure this is a simple one, please let me know.</p>
  
  <p>The if statement I've got at the moment is:</p>
  
  <pre><code>if [ `sudo -u firebird $GBAK_COMMAND | grep "gbak: ERROR"` == *gbak: ERROR* ]; then
     echo "$DATE Unsucessful $1.gdb Gbak. Incorrect user/password" &gt;&gt; /var/log/messages
     echo "Failed"
     exit 1
  else
     echo "pass"
  fi
  </code></pre>