介绍
在Linux中执行.sh脚本,异常/bin/sh^M: bad interpreter: No such file or directory。
分析:这是不同系统编码格式引起的:在windows系统中编辑的.sh文件可能有不可见字符,所以在Linux系统下执行会报以上异常信息。
解决方案
1)在windows下转换:
利用一些编辑器如UltraEdit或EditPlus等工具先将脚本编码转换,再放到Linux中执行。转换方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可。
2)也可在Linux中转换:
首先要确保文件有可执行权限
sh>chmod a+x filename
然后修改文件格式
sh>vi filename
利用如下命令查看文件格式
:set ff 或 :set fileformat
可以看到如下信息fileformat=dos 或 fileformat=unix
利用如下命令修改文件格式
:set ff=unix 或 :set fileformat=unix
:wq (存盘退出)
最后再执行文件
sh>./filename
Thanks to 수원여성전용마사지, I remembered how good it feels to be still, to rest, and to simply be.
Thiѕ іs a ցreat tіρ particularly to thoѕe fresh tο the blogosphere. Short Ьut very accurate info… Mɑny thankѕ for sharing this ⲟne. A must read post!
Every time the therapist’s hands passed over a sore spot, it felt as though they were saying, “You’ve been through enough. It’s time to rest now.” That’s the magic of 여성전용마사지.
Hello, yes this piece of writing is actually pleasant and I have learned lot of things from it about blogging. thanks.
You can definitely see your skills in the article you write. The sector hopes for more passionate writers like you who are not afraid to say how they believe. At all times go after your heart.
This is my first time pay a quick visit at here and i am really pleassant to read everthing at alone place.
能下吗?找了几个不是云盘就是下载不了的
dsadsads
欢迎加入 Typecho 大家族