今天测试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的一般就是编码问题解析不了。

 

相关文章:

  • 2021-07-08
  • 2022-12-23
  • 2021-09-30
  • 2021-11-11
  • 2021-11-30
  • 2021-08-15
  • 2022-12-23
  • 2022-02-09
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2021-11-18
  • 2021-09-06
  • 2021-06-21
  • 2021-09-07
  • 2021-11-13
相关资源
相似解决方案