Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bad interpreter? 1

Status
Not open for further replies.
May 31, 2006
237
US
This is a weird one. I have a script that runs on our PROD system and it works flawlessly. I copied the script over to our TEST system (identical platform - RHEL 3 with Kernel 2.4.21-60 ELsmp) and try to invoke it, and I get this error:

: bad interpreter: No such file or directory

I'm assuming this is referring to the #!/bin/sh line in the script? I checked and /bin/sh exists, is owned by root:root, and the mode is 755. Actually sh is just a pointer to bash, which is owned by root:root and mode 755, but I even tried changing the line to #!/bin/bash and it still gave me the same error. Runs perfectly on the PROD system.

Any ideas? Oh, I'm logged on as a user called luminis, on both systems. luminis has identical rights on both systems also.
 
Nevermind, I found the solution. Turns out the key was "I copied the script." I did this by SFTP'ing it to my local machine, then back up to the TEST system. Somehow this converted the format from unix to dos. So it wouldn't run properly on the TEST system. Instead, I did a scp from the PROD system to the TEST system and executed it, it ran perfectly.

Um, so thanks for listening. I know you would have helped if I gave you enough time LOL
 
Did you definitely use SFTP and not plain ol' FTP? You definitely didn't edit it on the local machine?

SFTP shouldn't have that effect on a file, it transfers files in binary mode.

Annihilannic.
 
No I probably opened it on the local machine but I honestly don't remember. And it was definitely SFTP, port 21 is closed on the firewall.
 
I have seen this any number of times when using WinSCP to transfer files. If you have the preferences/transfer/automatic option set (which I believe is the default) it will convert Unix script files to DOS format.

Set preferences/transfer to Binary and your files are transferred unmolested.
 
Well I'm not using WinSCP, I'm using scp from the shell on the Linux box. But I'll definitely keep that in mind.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top