同一脚本sh 脚本名 执行时报Syntax error: "(" unexpected:而./脚本名执行不报错,为什么呢 脚本内容如下: function usage(){ echo "usage:$0 url" exit } function check_url(){ -T $ ] then echo "$1 is ok" else echo "$1 is not ok " fi } function main(){ ] t…
在阅读的过程中有不论什么问题,欢迎一起交流 邮箱:1494713801@qq.com 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格式的, 即每一行的行尾以\…
写了个脚本用cat>>EOF报错如下: 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 原因:最后的EOF多了个空格,取消即可.…
有时我们在linux下执行一个sh文件,会报错“SYNTAX ERROR:UNEXPECTED END OF FILE”,这个现象主要是工作的系统环境改变造成的. 若最初脚本中是在windows下,使用sublime编辑器写.将shell脚本传至linux中:使用命令bash -x SCRIPT检查语法总是出一个错误 syntax error:unexpected end of file. 原因:dos文件传输到unix系统时,会在每行的结尾多一个^M,在vim的时候,当你用如下命令查看:cat…
Shell script fails: Syntax error: “(” unexpected google 一下. http://unix.stackexchange.com/questions/45781/shell-script-fails-syntax-error-unexpected The script does not begin with a shebang line, so the kernel executes it with /bin/sh. On Ubuntu, /bi…
SHELL syntax error:unexpected end of file 提示错误 if [ -n "$1" ] then " else " fi exit 执行sh my.sh par 提示syntax error:unexpected end of file.错误请问为什么啊? 文本编辑是在windows下通过记事本编写的这个文件,运行 在cygwin模拟LINUX软件环境下. 解决思路: DOS下文件和Linux下文件格式差异问题导致的. DOS下的…
问题: 在win下写好的shell脚本,放到Linux上测试sh -n报错如下 ORA_check.sh: line 251: syntax error: unexpected end of file 原因:dos文件传输到unix系统时,会在每行的结尾多一个^M,在vi的时候,当你用如下命令: vi dos.txt:set fileformat=unix:w就会看到这些存在于每行结尾的^M符号,这个就是产生syntax error:unexpected end of file的原因 解决方案…
0.前言 通常我们在编辑 Linux 服务器上的文件时,直接在 Linux 环境比较麻烦(当然熟练使用 VIM 的程序员除外哈哈),有时我们会使用 Windows 将文件编辑好再上传到服务器端,我用的是 Sublime text . 1.问题描述与记录 编辑完脚本上传到服务器运行时,会出现语法错误,以下面的一小段脚本为例 #!/bin/bash echo "updatedb..." sudo updatedb BASE_PATH=$(dirname $(locate $0)) echo…
用shell编写的一个脚本,执行的时候报错:syntax error: unexpected end of file! 发生这种报错有两种原因: 第一种: 如果你是用 windows 系统编写的脚本,那么就有可能是 fileformat 类型不同!可能是 fileformat=dos ,那么你需要把格式修改为unix,方法是直接输入 :set ff=unix,输入完成后回车即可看到:fileformat=unix 第二种: 如果你是用 Linux 系统编写的 shell 脚本,在 vim 的命令…
---恢复内容开始--- [Linux]Shell脚本“syntax error: unexpected end of file”原因及处理 :::https://blog.csdn.net/u013948858/article/details/79637851 关于shell文件中出现syntax error: unexpected end of file https://blog.csdn.net/u011510825/article/details/50110373 ---恢复内容结束…