title: Jenkinsfile - write environment variable to a file
body: <p>In my Jenkinsfile, I'm trying to add a environment variable to a file, however not able to do so - seems like some small syntax thing, however I've tried so many different variations.</p>
  
  <p>So the parameter I want is <code>"${params.Spec}"</code>, currently used like:</p>
  
  <pre><code>environment {
          SPECTORUN = "${params.Spec}"
  }
  </code></pre>
  
  <p>Then in my <code>script</code> block i'm trying:</p>
  
  <p><code>sh "echo Run:\"${params.Spec}\" &gt;&gt; allure-results/environment.properties"</code></p>
  
  <p>Any help would be appreciated.</p>
  
  <p>FOUND THE ANSWER HERE:
  <a href="https://stackoverflow.com/questions/41539076/how-to-pass-variables-from-jenkinsfile-to-shell-command">How to pass variables from Jenkinsfile to shell command</a></p>