title: SHELL: Build step 'Execute shell' marked build as failure
body: <p>I have the following script as a post build step in Jenkins:</p>
  
  <pre><code>#!/bin/sh
  out=$(sudo curl http://192.168.33.19:8080/job/$JOB_NAME/lastBuild/api/json/json.tail.test  --user "jenkins:jenkins" | jq -r '.result')
  
  res=$(echo $out|grep "FAIL")
  
  if [ "$res" = "FAILURE" ]; then
      curl -X POST -d 'json={"RESULT":"'$res'","JOB_NAME":"'$JOB_NAME'","BUILD_NUMBER":"'$BUILD_NUMBER'"}' http://localhost:8888/jenkins.e2e.build.status
  fi;
  </code></pre>
  
  <p>The build is SUCCESS but after executing the script, result becomes FAILURE with below console output in Jenkins:</p>
  
  <pre><code>+ out=SUCCESS
  ++ grep FAIL
  ++ echo SUCCESS
  + res=
  Build step 'Execute shell' marked build as failure
  Xvfb stopping
  Finished: FAILURE
  </code></pre>
  
  <p>What is the mistake I made in the script?</p>