title: shell script in jenkins to fail a job
body: <p>I have a small shell script that the jenkins job calls in the 'Execute shell'. The shell script has some code to fail the build in the parameters passed in are incorrect</p>
  
  <p>Here is the script.sh</p>
  
  <pre><code>    if [ $# != 2 ]; then
           echo "Your command should contain 2 arguments"
           exit 1
       fi
  </code></pre>
  
  <p>In the jenkins job i call this script has </p>
  
  <pre><code>   #!/bin/bash
     sh script.sh
  </code></pre>
  
  <p>When i call the shell script with no parmeters, i expect the build to fail.Instead it just prints the echo message and the job still shows success. How should I explicitly fail the build in this case?</p>