title: jenkins pipeline: multiline shell commands with pipe
body: <p>I am trying to create a Jenkins pipeline where I need to execute multiple shell commands and use the result of one command in the next command or so. I found that wrapping the commands in a pair of three single quotes <code>'''</code> can accomplish the same. However, I am facing issues while using pipe to feed output of one command to another command. For example </p>
  
  <pre><code>   stage('Test') {
        sh '''
           echo "Executing Tests"
           URL=`curl -s "http://localhost:4040/api/tunnels/command_line" | jq -r '.public_url'`
           echo $URL
           RESULT=`curl -sPOST "https://api.ghostinspector.com/v1/suites/[redacted]/execute/?apiKey=[redacted]&amp;startUrl=$URL" | jq -r '.code'`
           echo $RESULT
        '''
     }
  </code></pre>
  
  <p>Commands with pipe are not working properly. Here is the jenkins console output:</p>
  
  <pre><code>+ echo Executing Tests
  Executing Tests
  + curl -s http://localhost:4040/api/tunnels/command_line
  + jq -r .public_url
  + URL=null
  + echo null
  null
  + curl -sPOST https://api.ghostinspector.com/v1/suites/[redacted]/execute/?apiKey=[redacted]&amp;startUrl=null
  </code></pre>