Shell syntax error: unexpected end of file error message

Source: Internet
Author: User
Tags ftp file

Original post: http://topic.csdn.net/u/20071101/11/4bf1047d-dc46-4b39-9766-4f05b0eeaca7.html

Shell syntax error: unexpected end of file error message

[Closed, closed by: myepoch]
Add as a friend
Send private message
Online Chat
  • Myepoch
  • Myepoch
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:131
  • Total technical experts ranking:76086
  • Posting rate:26.51%
Posted on:2007-11-01 11:47:43 Landlord
If
[-N "$1"]
Then
Echo & quot; 111 & quot"
Else
Echo & quot; 222 & quot"
Fi
Exit 0

Execute sh my. Sh par and prompt syntax error: unexpected end of file. What is the error?
I wrote this file in notepad in windows and ran it in the cygwin simulated Linux software environment.
I think there should be no problem with the syntax itself. Does it affect character set encoding? How can I change it.

Problem points:10 Replies:8

Show all repliesShow star repliesShow landlord reply

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Cceczjxy
  • This machine is in hell
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:14376
  • Total technical experts ranking:1065
  • 6

    2

Posted on:2007-11-01 12:51:051Floor score:1
It may be a carriage return/r problem. you can remove it.
In Windows, the line feed uses two symbols. Press enter to change the line/R/n. in Linux, you only need one symbol/n.

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Myepoch
  • Myepoch
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:131
  • Total technical experts ranking:76086
Posted on:2007-11-01 13:03:252Floor score:0
Why should I press enter? I have already entered the above Code.

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Yecheng_110
  • I want to take advantage of the wind
  • Level:
  • Available levels:Zhongnong
  • Total technical experts:4568
  • Total technical experts ranking:4508
Posted on:2007-11-01 13:07:063Floor score:5
Dos2unix

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Mymtom
  • Mymtom
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:11510
  • Total technical experts ranking:1602
  • 2

Posted on:2007-11-01 13:44:274Floor score:1
Follow up with the xtrace option of sh.
Sh-X my. Sh par

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Myepoch
  • Myepoch
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:131
  • Total technical experts ranking:76086
Posted on:2007-11-01 13:52:105Floor score:0
#! /Bin/bash
If [-n "$1"]
Then
Echo & quot; 111 & quot"
Else
Echo & quot; 222 & quot"
Fi
Exit 0
-----------------
Sh-X my. Sh par
The error syntax error: unexpected end of file is still prompted. It's awful.

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Rezood
  • Tianxingjian, a gentleman strives for self-improvement
  • Level:
  • Available levels:Zhongnong
  • Total technical experts:789
  • Total technical experts ranking:23136
Posted on:2007-11-01 16:08:066Floor score:1
Whether the FTP file is in Bin format requires ASC

Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Mymtom
  • Mymtom
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:11510
  • Total technical experts ranking:1602
  • 2

Posted on:2007-11-01 16:41:117Floor score:1
After actual verification, the second floor is correct. It is used in VI.
: 1, $ S/^ m //
Replace ^ m:


Modify
Delete
Report
Reference
Reply


Add as a friend
Send private message
Online Chat
  • Mymtom
  • Mymtom
  • Level:
  • Available levels:Fu Nong
  • Total technical experts:11510
  • Total technical experts ranking:1602
  • 2

Posted on:2007-11-01 16:42:128Floor score:1
If you want to learn UNIX, use VI!

 

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.