title: bash error renaming files with spaces - mv target is not a directory
body: <p>I'm trying to rename a bunch of files which contain spaces in them, getting rid of the spaces.  I thought I found the correct bash command:</p>
  
  <pre><code>for f in *.txt; do mv \"$f\" ${f/ /}; done
  </code></pre>
  
  <p>However, this gives the error, "mv: target  is not a directory" for each file.  If I replace 'mv' with 'echo mv' in the command, it prints the proper mv command for each file, and if I type any of those mv commands individually, they work. For example, if I have 2 files, "a .txt", and "b .txt", and run the command above, I get:</p>
  
  <pre><code>mv: target 'a.txt' is not a directory
  mv: target 'b.txt' is not a directory
  </code></pre>
  
  <p>If I type the command:</p>
  
  <pre><code>for f in *.txt; do echo mv \"$f\" ${f/ /}; done
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>mv "a .txt" a.txt
  mv "b .txt" b.txt
  </code></pre>
  
  <p>I've found another way to do this, using "rename", but I would like to know why this doesn't work.</p>