title: command `file` cannot open *.txt
body: <p>I am practising to use the command <code>read</code>:</p>
  
  <pre><code>$ ls * | while read line; do printf "test %s\n"  $line; done
  test data1.txt
  test data5.txt
  test data6.txt
  test data7.txt
  </code></pre>
  
  <p>It works properly, but </p>
  
  <pre><code>$ ls * | while read line; do file $line; done
  data1.txt: cannot open `data1.txt' (No such file or directory)
  data5.txt: cannot open `data5.txt' (No such file or directory)
  data6.txt: cannot open `data6.txt' (No such file or directory)
  data7.txt: cannot open `data7.txt' (No such file or directory)
  data8.txt: cannot open `data8.txt' (No such file or directory)
  </code></pre>
  
  <p>The file names are legal</p>
  
  <pre><code>$ ls
  data1.txt  data5.txt  data6.txt  data7.txt  data8.txt
  </code></pre>
  
  <p>What's the problem with my code.</p>