Maybe the script has been written in dos/windows and it has created a directory named
adding a carriage return to the end. You can try to remove it using
where <Ctrl-V> and <Ctrl-M> have to be pressed in sequence to reproduce the ^M character. Then pass the script through the dos2unix command and everything should be fine.