LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "bad interpreter: No such file or directory " (https://www.linuxquestions.org/questions/linux-newbie-8/bad-interpreter-no-such-file-or-directory-444997/)

sumithnc 05-15-2006 09:34 AM

"bad interpreter: No such file or directory "
 
After running my shell scripts written in windows. I am getting : "bad interpreter: No such file or directory -"

how can i solve this thing..

I wanna learn linux badly ...help me guys .. Hilfe Hilfe

tmillard 05-15-2006 10:39 AM

Please post the first line of your script. You can use a terminal window and type
Code:

head -n 1 SCRIPT.FILE

nx5000 05-15-2006 10:39 AM

Code:

perl -pi -e 's/\r//g' <scriptname>
This is due to stupid end of line war. Even text files have different format between mac/linux/windows...

Wim Sturkenboom 05-15-2006 10:53 AM

If you use a 'decent' editor in windows, the problem does not occur. I use PFE which can save files in UNIX format. There are other ones as well.
As an alternative, you can make a little sed-script that does the trick (very similar to nx5000's code).

sumithnc 05-18-2006 10:28 AM

Guys thanks a lot for replies ..

But still none worked.

What i did was :
1. Create a copy of the file .
2.Delete the file.
3. Recreate the file in linux using touch filname.
4.Then vi filename
#!/bin/sh

:wq

5.Then copy the contents of the old file into this..

6.Now the shell script works..

chrism01 05-19-2006 01:05 AM

May I suggest you save yourself a lot of time and just learn vi/vim ? ;-)


All times are GMT -5. The time now is 01:38 AM.