Emmanuel Seyman wrote:
On Tue, Jun 03, 2003 at 02:51:05PM -0700, John Scamba wrote:

I am trying to run this simple script in RedHat 9.0
but i keep getting this error:
: bad interpreter: No such file or directory


Usually, this happens when the file you are trying to
run is not executable.

Actually it's what happens when you're running a script with no arguments and DOS linefeeds.


The first line of the file will always look like this:

#! /path/to/interpreter^M

If there were arguments to the script, or even just a space character at the end of the line, you won't see the ":bad interpreter" message:

#! /path/to/interpreter ^M

#! /path/to/interpreter -T -w^M

Both of the above would (normally) work.

The error message that's actually being printed is this:

bash: script.sh: /path/to/interpreter^M: bad interpreter: No such file or directory

The ^M character is a carriage return. When printed, it causes the cursor to return to the beginning of the line, so the latter half of the error message overwrites the first half. If you see a script print out only the latter half of the error message, you know there's a carriage return at the end of the first line of the file. :)


-- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to