title: shell variable not keeping value
body: <p>I have 3 lines in file <code>/root/backuplist.txt</code>. </p>
  
  <p>The first <code>echo</code> prints perfectly, but the last one prints an empty line; I'm not sure why. Somehow, the <code>$DIRS</code> value is getting unset.</p>
  
  <pre><code>#!/bin/bash
  
  cat /root/backuplist.txt |
  while read line
  do
    DIRS+="$line "
    echo $DIRS
  done
  
  echo $DIRS
  </code></pre>