Running the script: syntax error near unexpected token `$'{\r'

, Reason: The script is written under Windows, and the newline symbols of Windows and Linux are different, so an error is reported when the script is executed in Linux.

2. View: use notepad++ to open the script, view → display symbols → display all characters, as shown in the figure, the line break is CR LF,

But Linux is LF.

3. Solution: In notepad++, edit→document format conversion→convert to Unix format, and then run the script in Linux. Notepad++ should be a must for most people, so there is no need to find other software similar to dos2unix. 

 

 

 

Guess you like

Origin blog.csdn.net/qq_33468857/article/details/131052873