title: Jenkins dsl pipeline def variable
body: <p>I'm trying to define a variable into a jenkins pipeline dsl script by reading 3 files and concatenating the output. The 3 files content is:</p>
  <blockquote>
  <p>file1 content is: 127</p>
  <p>file2 content is: 0</p>
  <p>file3 content is: 1</p>
  </blockquote>
  <pre><code>def var1 = readfile('file1')
  def var2 = readfile('file2')
  def var3 = readfile('file3')
  
  def concatVar = &quot;${var1} + '_' + ${var2} + '_' + ${var3}&quot;
  printin ${concatVar}
  </code></pre>
  <p>The output I expect would be</p>
  <pre><code>printIn${concatVar} 
  127_0_1 
  </code></pre>
  <p>instead my output is:</p>
  <pre><code>printIn ${concatVar} 
  127
  _0
  _1
  </code></pre>
  <p>I know that I am wrong somewhere, but I don't know how to do it. Is there any of you familiar with the Jenkins pipepile dsl/groovy syntax?</p>
  <p>Thanks guys</p>