Sometimes some sh script files that are not handled properly in windows are put into Linux to execute, and an error is reported, indicating the existence of newline character
The main reason is that the end of EOL line in window is two characters, while in Linux and UNIX it is single character
Confirm with the VIM command below
#Display the carriage return character (\r), specifically in the vim environment it will be displayed as the ^M symbol
:e++ff=unix%
#Display the line feed (\n), specifically the $ symbol in the vim environment.
#This command also displays tabs, which are displayed in the vim environment as ^I symbols
:setlist
The above two VIM commands can also be viewed through a shell command
cat-Afilename
Delete the carriage return to make the shell script run normally
:%s/\r//g
You can also convert windows format file to Linux format file by shell instruction
dos2UNIXfilename
Attached:
Converting Linux format file to windows format file
UNIX2dosfilename