Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

./configure : /bin/sh^M : bad interpreter [duplicate]

I've been trying to install lpng142 on my fed 12 system. Seems like a problem to me. I get this error

[root@localhost lpng142]# ./configure bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory [root@localhost lpng142]#  

How do I fix this? The /etc/fstab file:

# # /etc/fstab # Created by anaconda on Wed May 26 18:12:05 2010 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/VolGroup-lv_root /                       ext4    defaults        1 1 UUID=ce67cf79-22c3-45d4-8374-bd0075617cc8 /boot                   ext4     defaults        1 2 /dev/mapper/VolGroup-lv_swap swap                    swap    defaults        0 0 tmpfs                   /dev/shm                tmpfs   defaults        0 0 devpts                  /dev/pts                devpts  gid=5,mode=620  0 0 sysfs                   /sys                    sysfs   defaults        0 0 proc                    /proc                   proc    defaults        0 0 
like image 878
Vineeth Pradhan Avatar asked May 27 '10 10:05

Vineeth Pradhan


People also ask

How do I fix bin bash'm a bad interpreter?

To fix the error in the Windows operating system, open the bash script file in the Notepad++ editor and then go to the preferences tab via the settings menu as below. Close the window after choosing Unix/OSX as the format. Afterwards, save and close the file.

What is #!/ Bin bash?

#!/bin/bash Essentially it tells your terminal that when you run the script it should use bash to execute it. It can be vital since you may be using a different shell in your machine ( zsh , fish , sh , etc.), but you designed the script to work specifically with bash.

What is bin sh Linux?

/bin/sh is an executable representing the system shell. Actually, it is usually implemented as a symbolic link pointing to the executable for whichever shell is the system shell. The system shell is kind of the default shell that system scripts should use.

What is M in bash?

^M is a carriage return, and is commonly seen when files are copied from Windows.


2 Answers

To fix, open your script with vi or vim and enter in vi command mode (key Esc), then type this:

:set fileformat=unix 

Finally save it

:x! or :wq!

like image 107
polymame Avatar answered Oct 10 '22 04:10

polymame


Looks like you have a dos line ending file. The clue is the ^M.

You need to re-save the file using Unix line endings.

You might have a dos2unix command line utility that will also do this for you.

like image 33
Richard Avatar answered Oct 10 '22 04:10

Richard