title: How to do something to every file in a directory using bash?
body: <p>I started with this:</p>
  
  <pre><code>command *
  </code></pre>
  
  <p>But it doesn't work when the directory is empty; the * wildcard becomes a literal "*" character. So I switched to this:</p>
  
  <pre><code>for i in *; do
     ...
  done
  </code></pre>
  
  <p>which works, but again, not if the directory is empty. I resorted to using ls:</p>
  
  <pre><code>for i in `ls -A`
  </code></pre>
  
  <p>but of course, then file names with spaces in them get split. I tried tacking on the -Q switch:</p>
  
  <pre><code>for i in `ls -AQ`
  </code></pre>
  
  <p>which causes the names to still be split, only with a quote character at the beginning and ending of the name. Am I missing something obvious here, or is this harder than it ought it be?</p>