/bin/sh^M: 错误的解释器:没有那个文件或目录 [英] /bin/sh^M: bad interpreter: No such file or directory

查看:48
本文介绍了/bin/sh^M: 错误的解释器:没有那个文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在终端中输入 brew doctor(或任何 brew 命令)时,我得到以下响应:

When I enter brew doctor (or any brew command) in my terminal, I get this as a response:

-bash:/usr/local/bin/brew:/bin/sh^M: 错误的解释器:没有那个文件或目录

-bash: /usr/local/bin/brew: /bin/sh^M: bad interpreter: No such file or directory

我之前看过 ^M 响应,我认为它与 dos 行结束文件有关.有没有办法解决这个问题?

I have seen the ^M response before and I think it has to do with dos line ending files. Is there a way to fix this?

推荐答案

我不知道回车是如何在你的 brew 文件中结束的,但你可以使用 dos2unix 或通过管道将它们删除通过 tr -d ' '.

I don't know how carriage returns ended up in your brew file, but you can remove them using dos2unix or by piping it through tr -d ' '.

示例:

tr -d '
'  < /usr/local/bin/brew   > myfixedbrew

验证通过后即可使用

mv myfixedbrew /usr/local/bin/brew && chmod a+x /usr/local/bin/brew 

替换旧的.

这篇关于/bin/sh^M: 错误的解释器:没有那个文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆