title: How to process file names with variables from a list in a file in Bash
body: <p>I have a file "FileList.txt" with this text:</p>
  
  <pre><code>/home/myusername/file1.txt
  ~/file2.txt
  ${HOME}/file3.txt
  </code></pre>
  
  <p>All 3 files exist in my home directory.  I want to process each file in the list from a bash script.  Here is a simplified example:</p>
  
  <pre><code>LIST=`cat FileList.txt`
  for file in $LIST
  do
    echo $file
    ls $file
  done
  </code></pre>
  
  <p>When I run the script, I get this output:</p>
  
  <pre><code>/home/myusername/file1.txt
  /home/myusername/file1.txt
  ~/file2.txt
  ls: ~/file2.txt: No such file or directory
  ${HOME}/file3.txt
  ls: ${HOME}/file3.txt: No such file or directory
  </code></pre>
  
  <p>As you can see, file1.txt works fine.  But the other 2 files do not work.  I think it is because the "${HOME}" variable does not get resolved to "/home/myusername/".  I have tried lots of things with no success, does anyone know how to fix this?</p>
  
  <p>Thanks,</p>
  
  <p>-Ben</p>