• 原因:
    我的脚本是在windows上创建并编辑的。
    windows下的换行是\r\n
    而linux下的换行只是\n
  • 解决办法:
  1. 显示换行符
    执行shell脚本报syntax error: unexpected end of file错误
  2. 将\r\n替换为\n (这里我使用的是Notapad++的替换,快捷键为Ctrl + H)
    执行shell脚本报syntax error: unexpected end of file错误
  • 或者在创建sh文件的时候使用如下设置(使用Notepad++编辑)
    执行shell脚本报syntax error: unexpected end of file错误
    执行shell脚本报syntax error: unexpected end of file错误

相关文章:

  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-01-11
相关资源
相似解决方案