Shell getting started: syntaxerror: unexpectedendoffile

Source: Internet
Author: User
Tags ftp commands
Shell getting started: syntaxerror: unexpectedendoffile decided to start learning shell, installed redhatlinux on a virtual machine on windows, complete network configuration, and interact with my windows. Other configurations are not required. Www.2cto.com start learning ba... shell getting started: syntax error: unexpected end of file decides to start learning shell, and installs redhat linux on a virtual machine on windows to complete network configuration and interact with my windows. Other configurations are not required. Www.2cto.com started to learn bash. every time the test code was written in windows, it was uploaded to linux for execution. When I learned the syntax for process control such as if, I met the first difficulty in writing the if test is always incorrect: "if. sh: line 11: syntax error: unexpected end of file ". -------------------------- The solution to this problem is as follows: use vi or vim to learn shell! -------------------------- Www.2cto.com syntax error, of course, it may not be visible, but in vi, the file format will be shown below, such as ”dos.txt "[dos] 120L, 2532C, it indicates a file in [dos] format. if it is a MAC system, it will display [MAC]. because of the file format, sometimes it will lead to errors in our unix program or shell program, the format of these dos files must be converted to the unix format by using vi dos.txt: set fileformat = unix: w. then the file will be converted to the unix format file. In general, this may happen when files are compiled on windows machines and uploaded to unix. In general, we use ftp commands, and the bin parameter is often added to indicate binary transmission, however, if the bin parameter is not added, it may be uploaded to the unix format. The final solution is to use the UltraEdit software. in the File menu, select DOS to unix for conversion, and the error will be solved.
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.