Shell problem -- Bad Interpreter
Upon trying to execute a shell script in the current directory via. "./shellcommand" I get the message:
bash: ./gitk-wish: /bin/sh^M: bad interpreter: No such file or directory It worked at one point and I am sure it involves a setting I somehow messed up. But look as I might I can't seem to find it. It is very annoying and prevents me from running shell scripts. Any guidance would be appreciated. |
hi,
please do Code:
cat -A gitk-wish Have you created the script on windows? Try dos2unix command. regards fl0 |
Check what's script sha-bang i.e. is it #!/bin/bash?
Just modify your script interpreter i.e. sha-bang to #!/bin/bash or #!/bin/sh (Just remove ^M character from it). Also once run your script with set -xv to check where it throws error... |
Your file has DOS end of line terminators (that's what the ^M on the end of the line means), you need to convert it to Linux. Most distributions have the "unix2dos" and "dos2unix" programs, which you can use with:
Code:
dos2unix gitk-wish |
Thanks
Problem solved.
Script had control characters from DOS creation. Got them from a clone of git. Did a "sudo yum install dos2uninx" and converted the file using: "dos2unix gitk-wish". Works great.. Thanks for your help! |
Is there anyway to convert a whole arch (tar.ball or git clone)?
|
All times are GMT -5. The time now is 11:40 PM. |