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
最新文章
- java 读文件路径问题
- hdu 4826(dp + 记忆化搜索)
- XML Basic
- curl测试网页响应时间
- 请不要做浮躁的IT人
- 如何使用新浪微博账户进行应用登录验证(基于Windows Azure Mobile Service 集成登录验证)
- [转载]SharePoint 2013 解决方案中使用JavaScript
- poi读写word模板 / java生成word文档
- css两个form不换行,两个div并排代码
- HDU 2586 + HDU 4912 最近公共祖先
- 自动生成proto Js语句
- css关键字unset
- 计算机网络之IP协议族
- Chapter 2 User Authentication, Authorization, and Security(7):创建和使用用户自定义服务器角色
- javascript的加减乘除结果会有误差,在两个浮点数相加的时候会比较明显。以下函数返回较为精确的计算结果
- EBS WEBADI导入日记账 客户化账户组合规则校验
- HTML5 加密和摘要算法(base64,md5, sha1,rsa)
- 【npm】伙计,给我来一杯package.json!不加糖
- 【English】20190307
- 分布式Redis缓存串讲(一)