syntax error:unexpected end of file

将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即可正常执行脚本了

来自为知笔记(Wiz)

时间: 2024-08-10 00:04:52

syntax error:unexpected end of file的相关文章

配置NDK Cygwin .bash_profile:行47: 语法错误: 未预期的文件结尾 syntax error: unexpected end of file 解决

可以在cygwin中通过vim修改,也可以在windows安装目录中修改 home\<你的用户名>\.bash_profile 文件中最后添加环境变量 NDKROOT=/cygdrive/e/Andriod/develop/android-ndk-r8 export NDKROOT 其中NDK=/cygdrive/<你的盘符>/<android ndk 目录> ,"NDK"这个名字随便起,以后经常用不要太长. 重启cygwin,输入: cd $NDK

PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法

今天在写PHP程序的时候总是出现这样的错误:Parse error: syntax error, unexpected end of file in *.php on line *,然后我就根据提示,找到那个文件,然后错误中总是提示最后一行出错,我找到最后一行发现是</html>,晕的,这能有什么错误,找了好久才找到问题所在,拿来分享. 出现这个错误的原因就是语法错误,肯定是PHP程序的书写不规范造成,我后来一条一条看才发现,原来是PHP语句标识符错了,正常情况下应该是这样的:<?php

Parse error: syntax error, unexpected end of file in *.php on line * 解决方法

Parse error: syntax error, unexpected end of file in *.php on line * 解决方法 这篇文章主要介绍了PHP错误Parse error: syntax error, unexpected end of file in test.php on line 12解决方法,需要的朋友可以参考下 今天在写PHP程序的时候总是出现这样的错误:Parse error: syntax error, unexpected end of file in

SHELL syntax error:unexpected end of file 提示错误

SHELL syntax error:unexpected end of file 提示错误 if [ -n "$1" ] then echo "111" else echo "222" fi exit 0 执行sh my.sh par 提示syntax error:unexpected end of file.错误请问为什么啊? 文本编辑是在windows下通过记事本编写的这个文件,运行 在cygwin模拟LINUX软件环境下. 解决思路: D

shell 报错:syntax error: unexpected end of file

有时执行脚本时会报错: [[email protected] shell]# sh -x test.sh + $'\r' : command not found test.sh: line 37: syntax error: unexpected end of file 原因可能是: 文本编辑是在windows下通过记事本或其它编辑器编写的这个文件,运行 在cygwin模拟LINUX软件环境下. 解决思路: DOS下文件和Linux下文件格式差异问题导致的. DOS下的文本文件是以\r\n作为断

【问题解决】syntax error: unexpected end of file或-bash: ./full_build.sh: /bin/bash^M: bad interpreter: No

在阅读的过程中有任何问题,欢迎一起交流 邮箱:[email protected]    QQ:1494713801 执行一个脚本full_build.sh 时, 一直是提示我: -bash: ./full_build.sh: /bin/bash^M: bad interpreter: No such file or directory 或提醒  syntax error: unexpected end of file 出现上面错误的原因之一是脚本文件是DOS格式的, 即每一行的行尾以\r\n来标

帝国备份王出现 Parse error: syntax error, unexpected end of file解决办法

帝国备份王出现 Parse error: syntax error, unexpected end of file解决办法,今天在WIN7 64位系统 用Xampp v3.2.2, 帮客户备份一下数据库,发现居然出现Parse error: syntax error, unexpected end of file iProg 的错误, 在网上搜索了一下,找到了解决办法.这里分享给大家. 解决办法:打开 php.ini ,找到 short_open_tag = Off 这一行,将 Off 修改为

linux 下出现 SHELL syntax error:unexpected end of file 提示错误

基本上可以判断是字符异常错误 首先注释掉尽快会出错的代码,然后进行判断 如果代码没有问题,可以修改字符格式 vim文本下,esc推出编辑模式  :set fileformat unix ,最后:wq 保存 ,错误消失. 参考http://blog.csdn.net/david_xtd/article/details/7577265

Parse error: syntax error, unexpected end of file

报错如下: 修改后: 原文地址:https://www.cnblogs.com/daikiti/p/8994711.html