This question already has an answer here:
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
This usually happens when you have edited a file from Windows and now trying to execute that from some unix based machine.
The solution presented on Linux Forum worked for me (many times):
Hope this helps.
PS: you need to have perl installed on your unix/linux machine.
Following on from Richard's comment. Here's the easy way to convert your file to UNIX line endings. If you're like me you created it in Windows Notepad and then tried to run it in Linux - bad idea.
Unix script file (*.sh;*.bsh)
chmod 755 the_script_filename
./the_script_filename
Any other problems try this link.
Or if you want to do this with a script:
Your configure file contains CRLF line endings (windows style) instead of simple LF line endings (unix style). Did you transfer it using FTP mode ASCII from Windows?
You can use
to fix this, or open it in vi and use
:%s/^M//g;
to substitute them all (use CTRL+V, CTRL+M to get the ^M)Thanks to pwc101's comment on this post, this command worked in Kali Linux .
sed -i s/{ctrl+v}{ctrl+m}// {filename}
Make sure you replace the bits in brackets,
{}
. I.e.{ctrl+m}
means press Ctrl key and the M key together.When you write your script on windows environment and you want to run it on unix environnement you need to be careful about the encodage :
dos2unix $filePath