/bin/sh^m:bad interpreter:no Such file or directory
Executes. sh script in Linux, exception/bin/sh^m:bad interpreter:no such file or directory.
Analysis: This is caused by different system encoding formats: the. sh file that is edited in the Windows system may have invisible characters, so the above exception information is reported in the Linux system execution.
Resolution: 1) under Windows conversion:
Use some editors, such as UltraEdit or EditPlus, to first convert the script encoding and then put it into Linux for execution. The conversion mode is as follows (UltraEdit): File-->conversions-->dos->unix.
2) can also be converted in Linux:
First, make sure that the file has executable permissions
#sh >chmod a+x filename
Then modify the file format
#sh >vi filename
Use the following command to view the file format
: Set FF or: Set FileFormat
You can see the following information
Fileformat=dos or Fileformat=unix
Use the following command to modify the file format
: Set Ff=unix or: Set Fileformat=unix
: Wq (save to withdraw)
Finally, execute the file.
#sh >./filename
SH Script exception