title: Not able to force exit on Jenkins Build
body: <p>I've been having a lot of trouble with this so here goes.</p>
  
  <p>I have a Jenkins build that executes the following shell script:</p>
  
  <pre><code>#!/bin/sh -x
  if [ 'grep -c "It misses" log' -gt 0 ];
  then exit 1;
  fi
  </code></pre>
  
  <p>I know that the grep returns 1 when it finds something and technically Jenkins should mark the build as failed on a non-zero exit, but the jenkins still marks it as a success.
  The console output for the jenkins build when running the script is:</p>
  
  <pre><code>Started by user bla
  [project_name] $ /bin/sh -x /var/tmp/hudson41276.sh
  + [ grep -c "It misses" log -gt 0 ] 
  Finished: SUCCESS
  </code></pre>
  
  <p>Could anybody give me a hand and point out what I'm missing here?</p>
  
  <p>Thanks,
  CJ</p>