title: Ubuntu - "mv" command renames file to empty file name
body: <p>I have a simple script to move files between directories. Basically, it is:</p>
  
  <p><code>mv /dir/* /dir/proc/</code></p>
  
  <p>saved into a shell script "mvproc.sh".</p>
  
  <p>For some reason, when I run the script (sh mvproc.sh) the file indeed gets moved, but it does not retain the filename and instead gets just an empty filename. When I run the same command at the bash prompt, it works fine however.</p>
  
  <p>This script used to work fine on Debian but we had a hard drive failure and I am now migrating everything over to a Ubuntu machine.</p>
  
  <p>Any idea why this is happening? It seems so simple yet I cannot figure it out.</p>
  
  <p>Many thanks.</p>
  
  <p>edit...</p>
  
  <p>I think I found the solution. For some reason it was putting in carriage returns and maybe line breaks or something that I could not see while editing the sh script in either Notepad++ or even gedit. To solve this, when I open the scripts in gedit, I do a Save As, and select Unix/Linux in the drop down menu towards the bottom. This hopefully gets rid of the weird carriage returns even though I could not see them.</p>
  
  <p>Hopefully this helps some poor soul like me in the future pulling their hair out over this!</p>
  
  <p>Thanks!</p>