./configure:/ bin / sh ^ M:错误的解释器[重复]

本文翻译自:./configure : /bin/sh^M : bad interpreter [duplicate]

This question already has an answer here: 这个问题已经在这里有了答案:

I've been trying to install lpng142 on my fed 12 system. 我一直在尝试在我的fed 12系统上安装lpng142。 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文件:

#
# /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

#1楼

参考:https://stackoom.com/question/CFjU/configure-bin-sh-M-错误的解释器-重复


#2楼

或者,如果您想使用脚本执行此操作:

sed -i 's/\r//' filename

#3楼

Following on from Richard's comment. 接下来是理查德的评论。 Here's the easy way to convert your file to UNIX line endings. 这是将文件转换为UNIX行尾的简单方法。 If you're like me you created it in Windows Notepad and then tried to run it in Linux - bad idea. 如果您像我一样,可以在Windows记事本中创建它,然后尝试在Linux中运行它-不好的主意。

  1. Download and install yourself a copy of Notepad++ (free). 下载并安装自己的Notepad ++副本(免费)。
  2. Open your script file in Notepad++. 在记事本++中打开您的脚本文件。
  3. File menu -> Save As -> 文件菜单 -> 另存为 ->
  4. Save as type: Unix script file (*.sh;*.bsh) 另存为: Unix script file (*.sh;*.bsh)
  5. Copy the new .sh file to your Linux system 将新的.sh文件复制到Linux系统
  6. Maxe it executable with: chmod 755 the_script_filename 使用以下chmod 755 the_script_filename可执行文件: chmod 755 the_script_filename
  7. Run it with: ./the_script_filename 使用以下./the_script_filename运行它: ./the_script_filename

Any other problems try this link . 任何其他问题,请尝试此链接


#4楼

您可以使用以下命令进行修复

cat file_name.sh | tr -d '\r' > file_name.sh.new

#5楼

This usually happens when you have edited a file from Windows and now trying to execute that from some unix based machine. 当您已经从Windows编辑了文件,现在尝试从基于UNIX的计算机上执行该文件时,通常会发生这种情况。

The solution presented on Linux Forum worked for me (many times): Linux论坛上提出的解决方案对我有用(很多次):

perl -i -pe's/\r$//;' <file name here>

Hope this helps. 希望这可以帮助。

PS: you need to have perl installed on your unix/linux machine. PS:您需要在unix / linux机器上安装perl。


#6楼

You can also do this in Kate. 您也可以在Kate中执行此操作。

  1. Open the file 开启档案
  2. Open the Tools menu 打开工具菜单
  3. Expand the End Of Line submenu 展开尾子菜单
  4. Select UNIX 选择UNIX
  5. Save the file. 保存文件。
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值