Execute SH script error:/bin/sh^m:bad interpreter: No file or directory

Source: Internet
Author: User

The following error was found in executing the script today:


/bin/sh^m:bad Interpreter: No file or directory

Error Analysis:

Because the operating system is windows, I edit the script 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 \n\r, and its ASCII code is 0x0d, 0x0A.

There are many ways to see if the file is in DOS or UNIX format, or in MAC format.

Workaround:

Vim filename

And then use the command

: Set FF #可以看到dos或unix的字样. If the DOS format is true.

and then use

: Set Ff=unix #把它强制为unix格式的 and then save to exit.

Run the script again.

Another workaround is to use the Dos2unix command to turn around, that is, enter: Dos2unix file name


This article is from the "Guardian" blog, please be sure to keep this source http://shouhouzhe.blog.51cto.com/2351955/1685470

Execute SH script error:/bin/sh^m:bad interpreter: No file or directory

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.