shell命令在windows下编辑过后出现Syntax error: end of file unexpected (expecting "then") 提示错误

Linux提示Syntax error: end of file unexpected (expecting "then") 提示错误

 

  

这是因为我在windows下些的脚本,windows和linux的回车换行时不一样的字符,所以脚本在解释时会出现问题。

在windows里,换行用的两个符号,回车换\r行符号\n,在linux下只需一个符号\n就可以了. 

 

sed -i 's/\r$//' autoconf.sh

 

通过命令把换行符转换一下就可以了.

相关文章:

  • 2021-09-19
  • 2021-06-16
  • 2021-06-10
  • 2022-01-11
  • 2021-11-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-17
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
相关资源
相似解决方案