Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 09, 2012, 09:12:39 PM

Pages: [1]   Go Down
  Print  
Author Topic: #!/bin/bash not accepted: ": bad interpreter: No such file or directorybin/bash"  (Read 1581 times)
pstein
Intergalactic Cowboy
*****
Offline Offline

Posts: 56


« 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

« Last Edit: December 11, 2007, 06:29:10 AM by pstein » Logged
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5083



« Reply #1 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.
Logged

Pages: [1]   Go Up
  Print  
 
Jump to: