Home » Questions » Computers [ Ask a new question ]

Bash script appending ^M to filename

Bash script appending ^M to filename

In one of my bash scripts, I am creating a file by repeatedly using echo with output redirection to append to the file. The resulting file, however, is not named properly, but always has an unprintable ^M character appended to the end. Does anyone know what I'm doing wrong? The following simple script demonstrates the problem:

Asked by: Guest | Views: 224
Total answers/comments: 1
Guest [Entry]

"I would suspect that you edited the file somewhere that added DOS-style line endings. Run your file through dos2unix to get rid of them.

dos2unix yourscriptfile"