Shell Script Fails:syntax Error: "(" unexpected

Source: Internet
Author: User
Tags shebang

Shell Script Fails:syntax Error: "(" unexpected

Google a bit.

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, was /bin/sh Dash, a shell designed for fast startup and execution with only standard features. When the dash reaches line is, it sees a syntax error:that parenthesis doesn ' t mean anything to it in context.

Since Dash (like all other shells) is a 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 has aborted once line is reached.

The shebang line must is the very first thing in the file. Since You use bash features, the first line of the file must is #!/bin/bash or #!/usr/bin/env bash .

is to change the first line #!/bin/bash or#!/usr/bin/env bash  

Shell Script Fails:syntax Error: "(" unexpected

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.