syntax error: unexpected end of file完美解决方案
用shell编写的一个脚本,执行的时候报错:syntax error: unexpected end of file!
发生这种报错有两种原因:
第一种:
如果你是用 windows 系统编写的脚本,那么就有可能是 fileformat 类型不同!可能是 fileformat=dos ,那么你需要把格式修改为unix,方法是直接输入 :set ff=unix,输入完成后回车即可看到:
fileformat=unix
第二种:
如果你是用 Linux 系统编写的 shell 脚本,在 vim 的命令模式下,执行 :set ff 就能看到 fileformat 类型是 unix ,那么恭喜你,你的 shell 脚本里存在语法错误,你可以使用二分法逐段检查错误,具体就是注释一部分,留一部分,然后执行 sh -n 脚本名字 来检查错误,知道排查处错误为止!
————————————————
版权声明:本文为CSDN博主「小白网管之路」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_44297303/java/article/details/102956879
syntax error: unexpected end of file完美解决方案的更多相关文章
- SHELL syntax error:unexpected end of file 提示错误
SHELL syntax error:unexpected end of file 提示错误 if [ -n "$1" ] then " else " fi e ...
- shell 报错:syntax error: unexpected end of file
有时执行脚本时会报错: [root@host1 shell]# sh -x test.sh + $'\r' : command not found test.: syntax error: unexp ...
- win-Linux文件脚本迁移过程中的问题 syntax error: unexpected end of file
问题: 在win下写好的shell脚本,放到Linux上测试sh -n报错如下 ORA_check.sh: line 251: syntax error: unexpected end of fil ...
- PHP关于syntax error语法错误的问题(Parse error: syntax error, unexpected end of file in xxxxxxxx)
在php程序出现类似 Parse error: syntax error, unexpected end of file in xxxxxxxx on line xx 的错误. 如图 如果发现php ...
- 【问题解决】syntax error: unexpected end of file或-bash: ./full_build.sh: /bin/bash^M: bad interpreter: No
在阅读的过程中有不论什么问题,欢迎一起交流 邮箱:1494713801@qq.com QQ:1494713801 运行一个脚本full_build.sh 时, 一直是提示我: -bash: ./ ...
- input01.sh: line 11: warning: here-document at line 4 delimited by end-of-file (wanted `EOF') input01.sh: line 12: syntax error: unexpected end of file
写了个脚本用cat>>EOF报错如下: input01.sh: line 11: warning: here-document at line 4 delimited by end-of- ...
- 报错解决——linux下执行sh出现异常"syntax error: unexpected end of file"
有时我们在linux下执行一个sh文件,会报错“SYNTAX ERROR:UNEXPECTED END OF FILE”,这个现象主要是工作的系统环境改变造成的. 若最初脚本中是在windows下,使 ...
- 解决执行脚本报syntax error: unexpected end of file或syntax error near unexpected token `fi'错误的问题
参考:https://blog.csdn.net/u012453843/article/details/69803244 解决执行脚本报syntax error: unexpected end of ...
- shell:syntax error:unexpected end of file/Starting proxy www-balancer: cannot bind socket--转载
src:http://www.2cto.com/os/201308/238962.html 执行某bash脚本是发生: syntax error: unexpected end of file 主 ...
随机推荐
- Markdown最新使用说明
Markdown基本语法说明 markdown 和 typora关系:typora是一款实时预览markdown的文本编辑器 本文推荐使用的Markdown编辑器为:Typora (用了多款编辑器,觉 ...
- 集合框架-工具类-Collections-逆序替换
1 package cn.itcast.p2.toolclass.collections.demo; 2 3 import java.util.ArrayList; 4 import java.uti ...
- [luoguP4139]上帝与集合的正确用法
\(\text{Description}\) \(\text{Given a number }p(p\leqslant10^7).\) \(\text{Output }2^{2^{2^{2^{\cdo ...
- vue组件中使用<transition></transition>标签过渡动画
直接上代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...
- Atcoder ARC-063
ARC063(2020.7.16) A \(A\) 题如果洛谷评分很低就不看了. B 可以发现一定是选择在一个地方全部买完然后在之后的一个地方全部卖完,那么我们就只需要即一个后缀最大值就可以计算答案了 ...
- JSP中的请求转发与重定向
在说请求转发和重定向之前,得了解下JSP九大内置对象中的response和request response:将服务器端数据发送到客户端,可通过在客户端浏览器中显示,用户浏览页面的重定向以及在客户端创建 ...
- oracle修改密码、添加用户及授权
解锁某个用户 sqlplus/as sysdba; alter user scott account unlock; 忘记密码处理 登录:sqlplus/as sysdba;修改:alter user ...
- Java线程--CountDownLatch使用
原创:转载需注明原创地址 https://www.cnblogs.com/fanerwei222/p/11867656.html Java线程--CountDownLatch使用, 代码里头有详细注释 ...
- 一招教你IDEA中Java程序如何打包,以及打包后如何运行
前言 编写程序 程序打包 测试运行 IDEA作为目前按最主流的Java程序项目编写工具,越来越受到开发人员的青睐.idea因为其五花八门的功能,让你在开发过程中效率显著提高.那么对于初学者来说,如何通 ...
- 配置docker的DNS
方式一:在宿主机的 /etc/docker/daemon.json 文件中增加以下内容来设置全部容器的 DNS: { "dns" : [ "114.114.114.114 ...