title: How to read a file into a variable in shell?
body: <p>I want to read a file and save it in variable, but I need to keep the variable and not just print out the file.
  How can I do this? I have written this script but it isn't quite what I needed:</p>
  
  <pre><code>#!/bin/sh
  while read LINE  
  do  
    echo $LINE  
  done &lt;$1  
  echo 11111-----------  
  echo $LINE  
  </code></pre>
  
  <p>In my script, I can give the file name as a parameter, so, if the file contains "aaaa", for example, it would print out this:</p>
  
  <pre><code>aaaa
  11111-----
  </code></pre>
  
  <p>But this just prints out the file onto the screen, and I want to save it into a variable!
  Is there an easy way to do this?</p>