Wednesday, March 18, 2015

Shell script error: bad interpreter: No such file or directory

It is highly likely that you created this file with a windows editor, which will place a <cr><lf> at the end of each line. This is the standard under dos / windows. However, under Unix / linux, the standard is to just put a <lf> at the end of the line.

Linux is now looking for a file called /bin/bash<cr> to interpret the file, where <cr> is a carriage return character, which is a valid file character under linux. Such a file doesn't exist. Hence the error.

Sublime Text 2 -> View -> Line Endings -> Unix

No comments:

Post a Comment