title: Shell script read a file line by line
body: <p>I am new to <code>shell scripting</code>. I need to read a file that works in all shells that has variables defined in it. Something like:</p>
  
  <pre><code>variable1=test1
  variable2=test2
      ....
  </code></pre>
  
  <p>I have to read this file line by line and prepare new string separated by spaces, like:</p>
  
  <pre><code>variable=variable1=test1 variable2=test2 ....
  </code></pre>
  
  <p>I tried with the below code:</p>
  
  <pre><code>while read LINE
  do
  $VAR="$VAR $LINE"
  done &lt; test.dat
  </code></pre>
  
  <p>but its throwing me this error:</p>
  
  <pre><code>command not found Test.sh: line 3: = variable1=test1
  </code></pre>