shell脚本报错:syntax error: unexpected end of file
解决办法1:
vi test.sh
:set fileformat=unix
:wq
解决办法2:
yum install dos2unix
dos2unix my.sh
原因剖析:
DOS下文件和Linux下文件格式差异问题导致的。【在windows里,换行用的两个符号,回车\r,换行符号\n,在linux下只需一个符号\n就可以了.】
shell脚本报错:syntax error: unexpected end of file的更多相关文章
- 【shell】真正解决syntax error:unexpected end of file?
今天写了个较长的shell脚本,结构嵌套比较多,最后运行时,出现了syntax error: unexpected end of file的错误. 这个之前碰到过,经常在win系统转移脚本文件到uni ...
- php Yii2使用registerJs或registerCss报错syntax error, unexpected end of file
解决方法: 注册时$js=<<<JS .....JS;//结尾处JS;应单独成行并且没有空格 JS;//这样就会报错,多了空格JS;//这样就不会
- shell 报错:syntax error: unexpected end of file
有时执行脚本时会报错: [root@host1 shell]# sh -x test.sh + $'\r' : command not found test.: syntax error: unexp ...
- 报错解决——linux下执行sh出现异常"syntax error: unexpected end of file"
有时我们在linux下执行一个sh文件,会报错“SYNTAX ERROR:UNEXPECTED END OF FILE”,这个现象主要是工作的系统环境改变造成的. 若最初脚本中是在windows下,使 ...
- Linux下docker报错syntax error:unexpected protocol at end of statement
---恢复内容开始--- [Linux]Shell脚本“syntax error: unexpected end of file”原因及处理 :::https://blog.csdn.net/u013 ...
- 执行shell脚本报错:syntax error near unexpected token `或syntax error: unexpected end of file
引起此问题最可能的原因是: 在windows下编写的文件上传到linux执行. 我是在notepad++上编写的代码,之后上传到linux执行,报此错误.仔细检查,语法方面没有错误.上网查了一下,发现 ...
- 解决执行脚本报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 提示错误
SHELL syntax error:unexpected end of file 提示错误 if [ -n "$1" ] then " else " fi e ...
- shell脚本报错:"[: =: unary operator expected"
shell脚本报错:"[: =: unary operator expected" 在匹配字符串相等时,我用了类似这样的语句: if [ $STATUS == "OK&q ...
- 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 主 ...
随机推荐
- 不输入密码执行SUDO命令
假如我们需要用户名nenew执行sudo时不用输入密码 1.打开sudoers: visudo /etc/sudoers 2.在文件的最后一行添加: nenew ALL=(ALL) NOPASS ...
- javascript/jquery获取url地址栏参数的方法
简洁jq方法获取url地址栏的参数 function getQueryVariable(variable){ var query = window.location.search.substring( ...
- (三)Knockout 控制流程
foreach 示例1:迭代数组 foreach binding主要作用于lists或是tables内数据单元的动态绑定.下面是一个简单的例子: <table> <thead> ...
- Visual GC提示"不受此JVM支持“解决方案(配置jstatd)
Visual GC提示"不受此JVM支持“,如果想使用这个插件,就需要配置jstatd连接方式,下面来看jstatd的配置: 1.配置安全策略文件路径$JAVA_HOME/jre/lib/s ...
- Vim使用心得
马上就要联赛啦. 学习一下vim 这是一个vim文档 http://vimcdoc.sourceforge.net/doc/ 这是一个优秀的vimrc配置 http://www.cnblogs.com ...
- Python-读文件
用python读一个文件,我们一般采用 open('文件名字')这里的文件名可以说完整路径也可以是相对路径(要读取的文件和和代码放在一起) f = open('data.txt')此时我们只是打开了 ...
- 前端性能优化 —— 添加Expires头
简要:添加Expires头能有效的利用浏览器的缓存能力来改善页面的性能,能在后续的页面中有效避免很多不必要的Http请求,WEB服务器使用Expires头来告诉Web客户端它可以使用一个组件的当前副本 ...
- angular.isString()
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- vue_小项目_模糊搜索(列表过滤)_结果排序
html <div id="test"> <label> <input type="text" v-model="sea ...
- Float.intBitsToFloat
Float.intBitsToFloat(0b) Float.intBitsToFloat(0) Float.intBitsToFloat(0x) ========================== ...