windows system edited script file, perform error / bin / sh ^ M on linxu: bad interpreter: No such file or directory

Such as the title!

phenomenon:

At that time the scene is this: I edited the script sh project in IDEA, and then use maven labeled zip package. Upload the zip package to extract the linux server running.

When you run the script sh file on the linux server, an error: / bin / sh ^ M: Bad Interpreter: No SUCH File or Directory

 

the reason:

windows line breaks and line breaks linux is different. I used the IDEA system comes with line breaks (windows), so the linux server, the line breaks have a problem.

 

Solution:

IDEA's words:

File -> setting -> Editor -> Code Style, modify the properties of "Line separator" as "Unix and OS X (\ n)"

 

If Eclipse:

Open the menu Window - Preferences, select the left General - Workspace, the right of the New text file line delimiter select Other, then select Unix inside

 

Guess you like

Origin www.cnblogs.com/danny-djy/p/10956847.html