title: Bash: Why mv won't move files under this for-loop?
body: <p><br>
  Using a Bash script, I'd like to move a list of files by using a for-loop, not a while-loop (for testing purpose). Can anyone explain to me why mv always acts as file rename rather than file move under this for loop? How can I fix it to move the list of files?<br></p>
  
  <p>The following works:</p>
  
  <pre><code>for file in "/Volumes/HDD1/001.jpg" "/Volumes/HDD1/002.jpg"
  do
      mv "$file" "/Volumes/HDD2/"
  done
  </code></pre>
  
  <p>UPDATE#1:<br>
  However, suppose that I have a sample_pathname.txt</p>
  
  <pre><code>cat sample_pathname.txt
  "/Volumes/HDD1/001.jpg" "/Volumes/HDD1/002.jpg"
  </code></pre>
  
  <p>Why the following for-loop will not work then?</p>
  
  <pre><code>array=$(cat sample_path2.txt)
  for file in "${array[@]}"
  do
      mv "$file" "/Volumes/HDD2/"
  done
  </code></pre>
  
  <p>Thanks.</p>
  
  <p>System: OS X<br>
  Bash version: 3.2.53(1)</p>