在执行shell脚本时,出现“syntax error : unexpected end of file"错误的解决方法
2017-08-06 11:07
1176 查看
首先,这个问题很可能是由于从其他系统编写的shell脚本在Linux下运行所造成的。
如果是这个问题,那么就进行如下操作:
1.编辑文件
#vim filename(文件名)
2.进入末行模式(按esc键)
3.设置文件格式
:set fileformat=unix
4.保存退出
:wq
5.#sh filename
OK!
注:前面的“#”是不需要自己写的(过于啰嗦的只是针对菜鸟们,高手可忽略)
如果是这个问题,那么就进行如下操作:
1.编辑文件
#vim filename(文件名)
2.进入末行模式(按esc键)
3.设置文件格式
:set fileformat=unix
4.保存退出
:wq
5.#sh filename
OK!
注:前面的“#”是不需要自己写的(过于啰嗦的只是针对菜鸟们,高手可忽略)
相关文章推荐
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
- VC++6.0中常出现的"unexpected end of file while looking for precompiled header directive"的问题解决方法
- npm install出现"Unexpected end of JSON input while parsing near"错误解决方法
- shell脚本执行后出现错误提示" /bin/bash^M: bad interpreter: No such file or dire"的解决办法
- linux脚本相关: Syntax error: end of file unexpected (expecting "then") 提示错误
- linux下执行sh出现异常"syntax error: unexpected end of file"
- shell脚本----调试脚本时候出现Syntax error: "(" unexpected错误解决
- angular 出现"Unexpected end of JSON input while parsing near"错误解决方法
- shell脚本调试报错:"syntax error: unexpected end of file"
- 解决shell错误:syntax error: unexpected end of file
- 解决shell错误:syntax error: unexpected end of file
- SHELL syntax error:unexpected end of file 提示错误; windows下修改linux文件导致linux文件无法使用
- Shelll 错误 syntax error: unexpected end of file
- VC++6.0中"unexpected end of file while looking for precompiled header directive"的解决方法
- PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法
- shell脚本“syntax error:unexpected end of file”解决方案
- SHELL syntax error:unexpected end of file 提示错误
- shell中出现syntax error: unexpected end of file
- shell中出现syntax error: unexpected end of file