经常会遇到这种情况,在windows下写的脚本,代码会在linux下无法执行,错误就是:

  : bad interpreter: No such file or directory

  以前一直不知怎么解决,今天终于找到方法了。

  1 原因

  这通常都是由于windows下对文本文件的保存格式与unix下不同造成的,windows下回车的字符是’\r\n’,而linux下是’\n’。

  2 解决方法

  vi file

  在命令模式下,输入 :set ff?

  查看文件格式为dos或者unix

  :set ff=unix

  :wq

  保存退出,即可。

相关文章:

  • 2022-12-23
  • 2021-05-20
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
猜你喜欢
  • 2022-12-23
  • 2021-11-25
  • 2022-02-09
  • 2021-10-15
相关资源
相似解决方案