title: How do I get the output of a shell command executed using into a variable from Jenkinsfile (groovy)?
body: <p>I have something like this on a Jenkinsfile (Groovy) and I want to record the stdout and the exit code in a variable in order to use the information later. </p>
  
  <pre><code>sh "ls -l"
  </code></pre>
  
  <p>How can I do this, especially as it seems that you cannot really run any kind of groovy code inside the <code>Jenkinsfile</code>?</p>