今日思语:晾久了,或许就变懒了

 

今日在linux服务器上执行脚本是莫名报syntax error: unexpected end of file错误,但仔细检查了并没法发现有什么地方写的不对,大概过程如下:

出现场景:在windows上用notepad+编写的脚本,如下

执行shell脚本报错 syntax error: unexpected end of file

编辑完保存通过xftp上传至服务器上执行就出错

执行shell脚本报错 syntax error: unexpected end of file

原因:windows编写的脚本文件格式在linux上不一样,导致linux无法识别

解决方式: 设置上传到liux上的文件格式为unix

执行shell脚本报错 syntax error: unexpected end of file

结果如下:

执行shell脚本报错 syntax error: unexpected end of file

重新设置为unix

执行shell脚本报错 syntax error: unexpected end of file

设置完后再查看

执行shell脚本报错 syntax error: unexpected end of file

再次执行脚本就正常了。

 

相关文章:

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