Lunarpages Web Hosting Forum

Author Topic: #!/bin/bash not accepted: ": bad interpreter: No such file or directorybin/bash"  (Read 3547 times)

Offline pstein

  • Intergalactic Cowboy
  • *****
  • Posts: 56
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:


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

: bad interpreter: No such file or directorybin/bash

Whats wrong ?

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


« Last Edit: December 11, 2007, 06:29:10 AM by pstein »

Offline MrPhil

  • Senior Moderator
  • Berserker Poster
  • *****
  • Posts: 6429
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.
Visit My Site

E-mail Me
-= From the ashes shall rise a sooty tern =-