Lunarpages Web Hosting Forum

Web Hosting Guidance and Advice => Lunarpages Beginner Assistance => Topic started by: pstein on December 11, 2007, 06:21:29 AM

Title: #!/bin/bash not accepted: ": bad interpreter: No such file or directorybin/bash"
Post by: pstein on December 11, 2007, 06:21:29 AM
I wanted to setup an own, new shell script (/usr/local/myname/myscript)
on our server

For that I entered as first line in the script file:

#!/bin/bash

But when I try to run this script (from SSH) I got the following error (note:
there is no other char between "....directory" and "bin..."):

: bad interpreter: No such file or directorybin/bash

Whats wrong ?

Yes, I call this script from bash (echo $SHELL shows "/bin/bash")

Peter

Title: Re: #!/bin/bash not accepted: ": bad interpreter: No such file or directorybin/b
Post by: MrPhil on December 11, 2007, 09:22:07 AM
This is on a VPS or dedicated server? It's very odd that the error message would drop the leading "/" and run everything together. What editor did you use to create the script? Could there be some invalid (and invisible) control code bytes in there? If nothing else, delete that line and type it in again.

If $SHELL says that /bin/bash is the address of the shell, that ought to work. If not, try looking around to confirm $SHELL was set correctly:

find / -name bash -print

and see if bash is in a different place than $SHELL claims. I think "bash" should be the correct name -- "bsh" would be the Bourne shell (not sure it even exists on a Linux system), and "sh" is probably a link back to "bash". Perhaps bash in in /usr or /usr/bin or /sbin or...?

If none of this helps, it's time to consult with support.