This happens because the file line break you are working with is "\ r \ n" in DOS format.
You can use the Cat-v file name to see if the newline character is, and if it is, the end of the line will be ^m
"\ n" needs to be converted into Linux/unix format
The specific conversion method is to convert the newline character.
You can use the SED command to process a file with the following command:
Sed ' s/\r//' original files > converted Files
The parameters of the SED command "represents the decision reference parameter, does not allow the value in the argument to be interpreted by the shell, S represents replace/followed by the replaced content, followed by//represents empty after the replacement
It is recommended to use EditPlus or UltraEdit, using these text editing tools, when saving, you can choose to save the type of text encoding, such as the choice of UNIX format line break. I prefer the EditPlus join Lines function, which turns multiple rows of values into a logical line, making it easy to write into a shell script as a loop variable
Shell script, when debugging, for loop that line of code, always errors syntax error near unexpected tokens do (RPM)