When the shell Script for window is transferred to the Linux server via FTP, the "No file or directory" solution is prompted in the shell script

Source: Internet
Author: User

The cause of the bad interpreter:no such file or directory is an issue with the document format. This file was written under Windows. Line wrapping is not the same as UNIX, but under vim if it is not set a bit and it is completely invisible.

Problem Analysis:
1. Write the shell file under Windows and upload it to Linux to execute, prompting for error.
2, error message: Bad interpreter: There is no file or directory.

Cause of the problem:
Because the operating system is windows, the script is edited under Windows, so there may be non-visible characters. The script file is in DOS format
That is, the line end of each line is identified by \ r \ n, and its ASCII code is 0x0d, 0x0A, respectively.

Workaround:
There are many ways to see if the file is in DOS or UNIX format, or in MAC format.
(1) Vim filename
Then use the command input: set FF Enter
Can see the word DOS or UNIX

If it is a DOS format, then use set Ff=unix to force it to UNIX format, and then save the disk to run.



When the shell Script for window is transferred to the Linux server via FTP, the "No file or directory" solution is prompted in the shell script

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.