/bin/sh^M: bad interpreter: no such file or directory to resolve
The following error was found when executing the script:
/bin/sh^M: bad interpreter: no such file or directory
Error analysis:
Because the operating
system
is
windows
, the script I edited under windows may have invisible characters.
The script file is in DOS format, that is, the end of each line is marked with \n\r, and its ASCII codes are 0x0D, 0x0A respectively.
There are many ways to see if the file is in DOS format, UNIX format, or MAC format
Solution:
vim filename
then use the command
:set ff? #You can see the words of
dos
or unix. If it is in dos format.
then use
:set ff=unix #Force it to unix format, then save and exit.
Run the script again.
Another solution is to use the dos2unix command to turn around, that is, enter: dos2unix filename