Windows和Unix下的编码问题

今天测试shell脚本时,执行报错:

./report.sh: /tmp/tmp.E8ekx6r5Qq/report.sh: /bin/bash^M: bad interpreter: No such file or directory

找半天原因,结果发现是Windows和Unix下的编码问题,不兼容

在Linux下用vi编辑文本,在命令模式下用命令set ff=Unix  ,问题就解决了。

Linux下测试经常会遇到这种情况,报错 ^M的一般就是编码问题解析不了。

原文地址:https://www.cnblogs.com/Nefeltari/p/4289961.html