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