Most commonly associated with 'sausaged' line endings i.e. the script has been writen/modified using an editor which saves/converts the file's line endings to something other than 'LF'.
Of course as suggested above, could just be you have specified a non-existant interpreter or the shebang line is missing.
redmonkey wrote:Most commonly associated with 'sausaged' line endings i.e. the script has been writen/modified using an editor which saves/converts the file's line endings to something other than 'LF'.
Of course as suggested above, could just be you have specified a non-existant interpreter or the shebang line is missing.
i pretty sure that the /bin/ stuff is there because i was able to originally run the script. What do you mean by the LF? i acquired this script from the forums and i jus copied and pasted it into putty and saved it as an sh file.
Putty isn't an editor. Have you changed/edited the file since? if so which editor did you use?
LF (or perhaps better understood as '\n') is the native line ending for Unix files, different operating systems use different line endings and in many cases the editors used default to the native line endings for which ever OS they are running on. Windows uses CR and LF (also noted as '\r\n') Macs use CR ('\r'). If you've pasted the script into an editor running on another OS, there is a possibility that the editor has added/changed the line endings to the OS's native line endings which can cause the 'Bad Interpreter' error.
The error message is normally more than just 'Bad Interpreter', was there any more to the message in your case?
thats all i saw on my screen. i know that putty is not an editor. while i ssh'ed in,i did nano ip.sh and then copied the entire text by copy and paste.is there any way i can fix this? (this is a script from this forum)
You first need to determine what the exact cause of the problem is before you can fix it. It may or may not be an issue with line endings (it probably isn't as you are using nano).
Why not write (from scratch) a simple script and try running it through the same interpreter.
If it is a line ending problem then there are a few file conversion utils available, try your favourite search engine for 'dos2linux' (or similar) I think that's the right name.