title: File content into unix variable with newlines
body: <p>I have a text file test.txt with the following content:</p>
  
  <pre><code>text1
  text2 
  </code></pre>
  
  <p>And I want to assign the content of the file to a UNIX variable, but when I do this: </p>
  
  <pre><code>testvar=$(cat test.txt)
  echo $testvar
  </code></pre>
  
  <p>the result is: </p>
  
  <pre><code>text1 text2
  </code></pre>
  
  <p>instead of</p>
  
  <pre><code>text1
  text2 
  </code></pre>
  
  <p>Can someone suggest me a solution for this?</p>