这个之前碰到过,很多时候在windows环境下面编写的脚本上传到linux系统中运行则会提示syntax error: unexpected end of file 或者 syntax error near unexpected token `$'\r''
这个是因为在win
系统的文件格式导致的,脚本文件上传到Linux/unix
系统时文件格式没有改变。关于系统文件格式转化:

用vim编辑打开文件,在命令模式下面

:set ff #在vim中查看文件的系统格式 :set fileformat=unix #在vim中将系统文件格式改为unix notepad++ 编辑的话 右键右下角选择转化为 unix

俗话曰:好记性不如烂笔头。每天记录一个日常工作中的小知识,督促自己一直学习~学习~在学习。