将window上编辑的xxy1.sh脚本上传到linux上,并执行的时候提示

xxy1.sh: line 17: syntax error: unexpected end of file
但是通过cat xxy1.sh查看脚本的时候,未发现语法异常,找了度娘后知道
 
原来是window和linux的文件格式不同导致,解决办法就是
(1)vi xxy1.sh
(2)按下键盘Esc键,按下键盘“:”冒号键
(3)输入:set fileformat=unix,后回车
(4)重复步骤2,输入:wq,后回车
在sh xxy1.sh即可正常执行脚本了

 

相关文章:

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