码迷,mamicode.com
首页 > 系统相关 > 详细

Shell script fails: Syntax error: “(” unexpected

时间:2015-07-22 18:08:36      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/ioio/p/4668087.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!