Windows and Linux file formats for mutual transfer

Source: Internet
Author: User

Sometimes writing good one scripts under Windows, copying to Linux does not work properly, the surface can not see the script syntax problems, but it does not work properly, and sometimes a script under Linux can run normally, but from somewhere in Windows (from the file or mailbox) copy a few commands , pasted into this script in Linux, and saved, the script also becomes not functioning properly. In both cases (in fact, the script in Linux contains content from Windows), the basic reason is that the file formats of the two systems are different.

Under Windows, the file line break is \ r \ n, and under Linux, it is \ n. This discrepancy causes a scripting error. When a file under Linux contains content from Windows, or the file is from Windows, use the command

Dos2unix < file name >

The problem of converting its format to file format differences is resolved.

Windows and Linux file formats for mutual transfer

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.