Format conversion encountered by shell file execution dos2unix

Problem description: In the sh file, in the win environment, edit with WinSCP, the following error occurs:

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

 

Solution: This is caused by the encoding of win, which can be solved as follows.

1. View the file: vim start.sh

2. Check the format of the error file (generally, the format of the error file is DOS):

:set ff

3. Modify the file format to UNIX:

:set ff=unix

4. Save again.

:wq

=======================

Or directly dos2unix *.sh recommend this method to be easy to use

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324789372&siteId=291194637