Execute Shell Foot report error: syntax error near unexpected token ' or syntax error:unexpected end of File

Source: Internet
Author: User

The most likely cause of this problem is:

Files written under Windows are uploaded to Linux execution.

I wrote the code on notepad++, and then uploaded it to Linux to execute it and report this error. Careful examination, there is no grammatical error. Surfing the Internet, found that Windows and Linux are different lines of the cause of the change.

Windows is carriage return + line Crlf;linux is just a line break LF

Cr means carriage return, enter, \R,ASCII code of 13

LF means linefeed, newline, \n,ascii code 10

In notepad++, you can view: View-show symbols-show line endings, with the following effects:

To run under Linux, you need to turn it into a Unix format file: Edit-Document Format conversion-to UNIX format with the following effect:

After that, it's no problem to upload to Linux.

or You can use Linux tools to convert files to UNIX files:Dos2unix file name

In addition, a syntax error:unexpected end of file error may also be caused by a syntax error. Use the Sh-n file name to check where syntax errors occur.

Execute Shell Foot report error: syntax error near unexpected token ' or syntax error:unexpected end of File

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.