The cause of the bad interpreter:no such file or directory is an issue with the document format. This file was written under Windows. Line wrapping is not the same as UNIX, but under vim if it is not set a bit and it is completely invisible.
Problem Analysis:
1. Write the shell file under Windows and upload it to Linux to execute, prompting for error.
2, error message: Bad interpreter: There is no file or directory.
Cause of the problem:
Because the operating system is windows, the script is edited 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 \ r \ n, and its ASCII code is 0x0d, 0x0A, respectively.
Workaround:
There are many ways to see if the file is in DOS or UNIX format, or in MAC format.
(1) Vim filename
Then use the command input: set FF Enter
Can see the word DOS or UNIX
If it is a DOS format, then use set Ff=unix to force it to UNIX format, and then save the disk to run.
When the shell Script for window is transferred to the Linux server via FTP, the "No file or directory" solution is prompted in the shell script