CRLFs in bash scripts

I occasionally run into this error when working with bash shell scripts:

: bad interpreter: No such file or directory

Sometimes the line begins with munged-together directory paths.

The problem is Windows-style CRLF line-terminators rather than UNIX-friendly LF terminators. A quick run of dos2unix fixes it nicely.

The CRLFs sneak in because I often write and test apps on Windows (Cygwin to the rescue) and then deploy them to Linux.

Comments