I. Overview
Today in the windows environment by Idea
writing shell
a script, it performs the following error after uploading packages to linux environment:
-bash: ./xxx.sh: /bin/sh^M: bad interpreter: No such file or directory
2. The cause of the problem
This problem is due to write in the windows shell
at the end of the descriptor file is dos
under the command can not be executed under linux.
You can view it through the following steps.
1. Execute the command:
vim xx.sh
2. Finally you can see it in the opened file, as shown below. You can see that the end of this document is.dos
Three, the solution
Solution one
The steps are as follows:
1. Execute the following command to open the document.
vim xx.sh
2. Execute the following commands to modify the terminator
:set ff=unix
3, execute wq
save the file.
Solution two
It can be directly idea
modified. As shown below, first select the file.
Solution three
It can be solved by notepad++, as shown below
The English version of notepad++ is Edit> EOL Conversion> Unix(LF)
Solution four
Solved by eclipse. First you need to select the file