Linux.com

Home Learn Linux Linux Tutorials Converting Files from Windows Format to Unix Format with dos2unix

Converting Files from Windows Format to Unix Format with dos2unix

Ever run a shell script and get the following error?

# ./dosfile.sh 
: bad interpreter: No such file or directory

The error may look like there is a problem with your scripts SHEBANG where you specify the interpreter, so you go look and the line contains #!/bin/bash which is correct. So then you start wondering if there is a problem with the /bin/bash binary, and all sorts of thoughts of what would happen if /bin/bash was missing or broken start racing through your head. Luckily though, the issue isn't that complicated.

What are EOL characters

The issue has nothing to do with the bash binary at all, but rather the issue is with the contents of the shell script itself. The problem is specifically due to the type of end of line characters in the file. Each operating system has a specific special character that symbolizes the end of a line.

Read more at bc-log

 

Comments

Subscribe to Comments Feed

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board