Syntax error near unexpected token ' newline ' script cannot be executed

Source: Internet
Author: User
Problem description

Execute run.sh script is an error, the error message is as follows:

/data/app/information-provider
: No such file or directory
: command not found
./run.sh:line 4:syntax Error Near unexpected token ' newline '
/run.sh:line 4: ' Case ' $ ' in  
Problem analysis

Find the script, there is no problem with the script, so I suspect that the file format is not correct.
View the file by following the command

Cat-a run.sh

Found in run.sh, line wrap ends with ^m$

Server= "$ (dirname" ${bash_source[0]} ")" && pwd ^m$
cd $server ^m$ ^m$ case
"$" in  ^m$
  ^ m$ ...
  
Solutions

Execute the following statement to convert run.sh to a new line character in the Linux environment $

Dos2unix run.sh

View the transform file by Cat-a run.sh as:

Server= "$ (dirname" ${bash_source[0]} ")" && pwd $
CD $server $
$ case
"$"
  $

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.