THE sh file cannot be executed after modification in windows and the shell script contains Chinese garbled characters.

Source: Internet
Author: User

THE sh file cannot be modified in windows.

Because most people use windows as the operating system and the visual interface of windows is more user-friendly, when modifying a linux sh file, edit it with editplus to facilitate pulling it to the window, after uploading it back to linux, the sh cannot run. The error message is: command not found.

The cause is the CR/LF problem. In dos/window, press the Enter key once. In fact, the input is "Enter CR)" and "line feed LF )", in linux/unix, press the Enter key once and only enter "line feed LF)". Therefore, the modified sh file has an additional CR in each line, therefore, when running in linux, an error is reported and the command cannot be found.

Solution:

1. Use UltraEdit to write a shell script in windows. After writing the script, you can avoid command notfound errors and Chinese garbled errors caused by different windows carriage returns and LINUX carriage returns using the following methods.

1). configurable file-> conversion->DOS-> UNIX.

2). After the modification, You need to click the file-> set to save as, the encoding method is selected as UTF-8-no BOM, save UNIX line break-LF ). As shown in.

650) this. width = 650; "width =" 553 "height =" 137 "src ="/e/u/themes/default/images/spacer.gif "style =" border: 1px solid # ddd; "alt =" spacer.gif "/>





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.