在PC端(windows)source insight编辑的.sh脚本文件,放到Linux系统里边执行报错:
bash: ./hello.sh: /bin/bash^M: bad interpreter: No such file or directory
原因是window下编辑的为dos格式,Linux只认Unix格式,需要转化,所以需要安装一个格式转化工具:
dos2unix
apt install dos2unix
安装完成后
dos2unix hello.sh
转换格式后再执行:
./hello.sh
结果正确。
以上。

1384

被折叠的 条评论
为什么被折叠?



