title: Assign file names to a variable in shell
body: <p>I'm trying to write a script that does something a bit more sophisticated than what I'm going to show you, but I know that the problem is in this part.</p>
  
  <p>I want each name of a list of files in a directory to be assigned to a variable (the same variable, one at a time) through a <code>for</code> loop, then do something inside of the loop with this, see what mean:</p>
  
  <pre><code>for thing in $(ls $1);
  do
      file $thing;
  done
  </code></pre>
  
  <p>Edit: let's say this scrypt is called Scrypt and I have a folder named Folder, and it has 3 files inside named A,B,C. I want it to show me on the terminal when I write this:</p>
  
  <pre><code>./scrypt Folder
  </code></pre>
  
  <p>the following:</p>
  
  <pre><code>A: file
  B: file
  C: file
  </code></pre>
  
  <p>With the code I've shown above, I get this:</p>
  
  <pre><code>A: ERROR: cannot open `A' (No such file or directory)
  B: ERROR: cannot open `B' (No such file or directory)
  C: ERROR: cannot open `C' (No such file or directory)
  </code></pre>
  
  <p>that is the problem</p>