title: Jenkins Pipeline exiting when grep command of shell script fails
body: <p>I have a Jenkinsfile written for Scripted Pipeline where I have the following piece of code:</p>
  
  <pre><code>sh """ cd $WORRKSPACE
         source myscript.sh
         cd \${EXPORTED_VAR1}
         .
         .
         .
  """
  </code></pre>
  
  <p>So I source myscript which in turn has a source command in it, say <code>source their_script.sh</code> . The problem is like their_script.sh contains a line <code>echo $0 | egrep -iqe string</code>. And whenever egrep finds no match my Jenkins job exits. But this happened suddenly and it was working till yesterday!!!</p>
  
  <p>I understand that grep returns status 1 when it finds no match and that is why it exits. But I wanted myscript to continue even if grep failed. I also understand that using <code>set +e</code> and <code>set -e</code> will help me not to exit if grep fails. But I am not allowed to modify their_script.sh. If I add <code>set +/-e</code> when I call myscript itself, will the case be like none of the errors will exit the script? Wont it ignore all errors from exiting?</p>
  
  <p>Is there any solution so that I can continue with my job even if grep fails?</p>