Shell script fails: Syntax error: “(” unexpected
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, /bin/sh is dash, a shell designed for fast startup and execution with only standard features. When dash reaches line 68, it sees a syntax error: that parenthesis doesn't mean anything to it in context.
Since dash (like all other shells) is an interpreter, it won't complain until the execution reaches the problematic line. So even if the script successfully started at some point in your testing, it would have aborted once line 68 was reached.
The shebang line must be the very first thing in the file. Since you use bash features, the first line of the file must be #!/bin/bash or #!/usr/bin/env bash.
就是把第一行改为 #!/bin/bash 或者 #!/usr/bin/env bash
Shell script fails: Syntax error: “(” unexpected的更多相关文章
- Shell脚本:“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 ...
- 不同系统执行相同shell脚本,出现Syntax error: "(" unexpected错误解决
例如shell脚本在centos系统中能正常执行,而在ubuntu系统中执行会出现类似Syntax error: "(" unexpected的错误,一般这种是因为sh与bash有 ...
- 【shell】真正解决syntax error:unexpected end of file?
今天写了个较长的shell脚本,结构嵌套比较多,最后运行时,出现了syntax error: unexpected end of file的错误. 这个之前碰到过,经常在win系统转移脚本文件到uni ...
- 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 主 ...
- 执行shell脚本报错:syntax error near unexpected token `或syntax error: unexpected end of file
引起此问题最可能的原因是: 在windows下编写的文件上传到linux执行. 我是在notepad++上编写的代码,之后上传到linux执行,报此错误.仔细检查,语法方面没有错误.上网查了一下,发现 ...
- 执行shell脚本遇到错误syntax error: unexpected "then" (expecting "}")
今天执行脚本的时候遇到错误,如下图: root@ApFree:/usr/sbin# ./conntrack_num_graph.sh ./conntrack_num_graph.sh: line : ...
- 报错解决——linux下执行sh出现异常"syntax error: unexpected end of file"
有时我们在linux下执行一个sh文件,会报错“SYNTAX ERROR:UNEXPECTED END OF FILE”,这个现象主要是工作的系统环境改变造成的. 若最初脚本中是在windows下,使 ...
随机推荐
- Flood-it!
Flood-it! 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4127/http://acm.split.hdu.edu.cn/showproble ...
- 修改VirtualBox虚拟机默认存储路径及虚拟机迁移方法
修改默认安装路径 在安装完虚拟机以后发现我的虚拟的磁盘文件是放在C盘的,就想着有没有办法修改默认存储路径.后来发现确实可以修改,修改虚拟机方法如下:"管理"--->" ...
- display:inline-block和float:left的选择
参考文章: http://www.zhangxinxu.com/wordpress/2010/11/%E6%8B%9C%E6%8B%9C%E4%BA%86%E6%B5%AE%E5%8A%A8%E5%B ...
- Sun jdk, Openjdk, Icedtea jdk关系
转自: http://blog.chinaunix.net/uid-20648944-id-3204527.html Sun jdk与Openjdk版本发展历史如下图所示: 1. Openjdk ...
- oracle 写入txt
分几个步骤 1,创建输出路径,比如你要在/orcl/dir目录下输出,你就先要建立好这个路径,并在root用户下 chmod 777 /orcl/dir 2,sqlplus下以sysdba登录,执行以 ...
- mysql 取出的日期数据缺少时分秒
项目使用的数据库是mysql 持久层框架是hibernate 利用SQLQuery 获取日期的时候缺少时分秒 将 .addScalar("dealTS",StandardB ...
- 安装Python package
下载对应的源码,往往都是.tar.gz,.zip的压缩包,解压. 打开windows的cmd,切换到对应目录 C: cd C:\xx setup.py install
- geom设置—条形图
条形图可能是所有图形里面最基本的图形了,虽然很简单,在R里面有些地方不注意,还是会很容易出错. geom_bar()的基本参数情况 geom_bar(mapping = NULL, data = NU ...
- apache 配置
apache 2.4.9 httpd-vhosts.conf部分 <VirtualHost *:81> //配置端口 DocumentRoot "E:/H ...
- 2015 ACM/ICPC Asia Regional Hefei Online
1001 Monitor the Alpacas 1002 The Relationship in Club 1003 Difference of Clustering 两边离散化.暴力扫C就过了. ...