I am trying to create a simple bash script that can run the "specific" port scan on mulitple IPs and Ports using nmap -p. The issue I am having is that when it reads the port# followed by the IP from the .txt file, the text file has the necessary space between port and IP, but it causes the script to fail. The code I have is below. I was trying to make this simple the only other thing I can think of is creating an array, but even then I am thinking that format for the nmap -p port scan is going to have the same issue. Any suggestions?
for i in $(cat 'filepathway') do nmap -p $i done
its executing this: nmap -p 'port#'
instead of this: nmap -p 'port#' 'IP#'
The .txt looks like this:(these values are random)
23001 172.55.545.254 23002 172.55.545.254