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