Scenario: When using nmap combined with the for loop to detect the ip in the text, it is found that there is a newline character \r after each line of ip, which affects the execution of the shell script
Solution: use vim editor to do the replacement:
use
vim -v file //Open the file and execute the following replacement command :%s/\r//
After processing, open it again as follows: