title: bash: interpret string variable as file name/path
body: <p>My bash script receives a filename (or relative path) as a string, but must then read from that file.  I can only read from a filename if I declare it as a literal directly in the script (without quotes)...which is impossible for arguments since they are implicitly strings to begin with.  Observe:</p>
  
  <pre><code>a="~/test.txt"
  #Look for it
  if [[ -a $a ]] ; then
      echo "A Found it"
  else
      echo "A Error"
  fi
  #Try to use it
  while read line; do
      echo $line
  done &lt; $a
  
  b='~/test.txt'
  #Look for it
  if [[ -a $b ]] ; then
      echo "B Found it"
  else
      echo "B Error"
  fi
  #Try to use it
  while read line; do
      echo $line
  done &lt; $b
  
  c=~/test.txt
  #Look for it
  if [[ -a $c ]] ; then
      echo "C Found it"
  else
      echo "C Error"
  fi
  #Try to use it
  while read line; do
      echo $line
  done &lt; $c
  </code></pre>
  
  <p>YIELDS:</p>
  
  <pre><code>A Error
  ./test.sh: line 10: ~/test.txt: No such file or directory
  B Error
  ./test: line 12: ~/test.txt: No such file or directory
  C Found it
  Hello
  </code></pre>
  
  <p>As stated above, I can't pass a command line argument to the routines above since I get the same behavior that I get on the quoted strings.</p>