chris Dark Lord of the Sith

Joined: 10 May 2003 Posts: 6262 Location: Outer Space
|
Posted: Mon Mar 12, 2007 8:15 pm Post subject: Error: bad interpreter: No such file or directory |
|
|
|
Problem: You try to run a script, say xxx.sh, and you get this error:
| Code: |
: bad interpreter: No such file or directory
|
No matter what you try, you keep getting this fantastic error!
Normally, scripts contain a first line like
or
or similar. This is a "hint" as to which "interpreter" to use to run the script. Of course, if /bin/sh or /usr/bin/perl or whatever is not there, or is there but is not executable, then yes, it is a "bad interpreter". But what if all this seems OK and you still get that fantastic "bad interpreter" error?
Reason: The file looks OK, but it is a DOS file!. This is often the case with Linux scripts supplied inside .zip files that contain some Java program. The author was kind enough to supply a xxx.bat and a xxx.sh start script for Windows and Linux respectively.
Now, if you unzip this in Windows, the xxx.bat will work fine. But if you unzip it in Linux, make xxx.sh executable and try to run it, you will get the above error.
Actually, vi warns about this in its status line: it prints a "[dos]" - but one gets blind to messages in the status line with time...
Solution: Just convert the file to "unix type" with:
and be happy!  _________________ Regards
Chris Karakas
www.karakas-online.de |
|