Posts Tagged ‘Bash’

Script fails with “No such file or directory”

July 9, 2008

While running a script it fails immediately with “No such file or directory“. Even a print or echo command in the second line of the script is ignored. The used program to process the script does exist and is running, too. In this case checking the line endings may help:

file nameofthescript

will report:

ISO-8859 English text, with CRLF line terminators

but expected is:

ISO-8859 English text

The problem are the CR/LF line endings. These are typically used from MS Windows applications. Correct the line endings using any editor. For MS Windows try the Notepad++ open source editor. It has a build-in menu item to fix the line endings: Format -> Convert to Unix.

Advertisements