title: envsubst not working as expected in a bash for loop
body: <p>I'm trying to use bash's <code>envsubst</code> to substitute an environment variable into a file. Here's a simple example that fails to work as expected:</p>
  
  <p>Create a file with a variable substitution in it:</p>
  
  <pre><code>echo 'Filename: ${FILE}' &gt; test.txt
  </code></pre>
  
  <p>Now try to use envsubst in a for loop:</p>
  
  <pre><code>for FILE in `ls`; do envsubst &lt; test.txt; done
  
  Filename:
  </code></pre>
  
  <p>The result is just <code>Filename:</code> the substitution fails.</p>
  
  <p>Echo works as expected in this context:</p>
  
  <pre><code>for FILE in `ls`; do echo Filename: ${FILE}; done
  
  Filename: test.txt
  </code></pre>
  
  <p>I don't understand why echo would work and envsubst would fail.</p>