本文最后更新于:2024年1月14日 晚上

本文记录 Syntax error: end of file unexpected (expecting “then”) 错误解决方案。

问题原因

出现问题的原因是.sh文件是dos格式文件,但是linux的shell需要unix格式的文件

解决方案

  • 转换文件格式
1
2
$ sudo apt-get install dos2unix
$ dos2unix <filename>
  • 随后重新运行 sh 文件

参考资料



文章链接:
https://www.zywvvd.com/notes/system/linux/expect-then/expect-then/


“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信二维码

微信支付

支付宝二维码

支付宝支付

LINUX下运行.sh文件出现Syntax error end of file unexpected (expecting “then”) 解决方案
https://www.zywvvd.com/notes/system/linux/expect-then/expect-then/
作者
Yiwei Zhang
发布于
2021年8月17日
许可协议