I have moved around some of the files in my home area. I am now trying to execute a bash script but I don’t know what to put as the she-bang, what should it be? I thought
but i no longer have a bin directory in my home path, i moved it to sw/bin and there is no env directory - what should i do?
Maximum Cash Discount on any plan with MAXCASH
How To Install PHP.INI / ionCube on DreamHost
Yes, but I have moved or deleted bash so when bash tries to execute:
-bash: /home/morgwaan/sw/bin/time2: /bin/bash^M: bad interpreter: No such file or directory
You can’t “remove” /bin/bash persay.
$ which bash should return your currently useable path. Look in .bash_profile to see if it’s overwriting too much.
It looks like you wrote the script in Windows, so it tacked a CTRL M on the end. Run dos2unix on the script to strip those off.
Cheers man, that was pretty stupid of me.
So, what is actually happening when I specify #!/bin/bash is it looking in the Dreamhost server route for bash?
Thanks for all your help!
#! tells the script in which mode (shell) to run. All shells, such as bash, are part of the Linux installation on the server. It’s really just another UNIX command.
Take a closer to the error message you previously posted here.
The error suggests that ‘/bin/bash^M’ was not found.
The end-of-line sequence of Linux systems is ‘^J’@(CTRL-J),
while Windows prefer ‘^M^J’.
So you got rid of trailing ‘^M’s by dos2unix in order to use
’/bin/bash’ instead of ‘/bin/bash^M’.
Excellent idea! Where have I seen that before?
hmm, what are you talking about?
You teached him how-to, and then he wanted to know why.
Nah, he wanted to know what the #!/bin/bash header did.