CentOS6 Shell Script/bin/bash^m:bad Interpreter Error resolution method

Source: Internet
Author: User

Save a script file under Windows, upload to CentOS with SSH, add permission to execute Nginx prompt without that file or directory.
The shell script is placed in the/etc/init.d/directory, and then executes the/etc/init.d/nginx, prompting more of this sentence/bin/bash^m:bad interpreter.
We found the information on the Internet.
If the script is edited under Windows, it is possible to convert it to a DOS text format under Windows, in which case the end of each line is identified by \ r \ n, and its ASCII code is 0x0d,0x0a. If you put this script file directly on Linux, you will be reported/bin/bash^m:bad interpreter error prompt.
The solution is very simple, first you have to check to see if your script file is caused by this problem, with the VI command to open the script file to check, and then use
: Set FF?
Command check to see if it is a DOS word, if it is DOS format, continue to execute
: Set Ff=unix
And then execute
: QW
Save to exit.

Reprinted from: https://my.oschina.net/chunto/blog/227003

CentOS6 Shell Script/bin/bash^m:bad Interpreter Error resolution method

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.