shell script error

A few days ago in the pc computer write a shell script to execute springboot project, then an error when centos7 executed, the script follows simple: start.sh, the following list is only a part of the script code

2, a copy of the script to execute linux server reported the following error:

-bash: ./test.sh: /bin/bash^M: bad interpreter: No such file or directory 

Later checked the information given reason is:

My start.sh the format is: fileformat = dos

start.sh is my windows edit and then upload it to linux system execution. .Sh file format to dos format. The linux unix format can only be performed in the format of the script.

3, the solution using the vi command to modify file modify file format is start.sh unix

Use the command: set ff = unix

Check again:

The last execution ./start.sh start can be properly started. . . .

 

Guess you like

Origin www.cnblogs.com/cx-20190810/p/11331195.html