Sample Header Ad - 728x90

Traverse Through Space-separated String

2 votes
2 answers
4943 views
So I ran ips=$(arp | awk '{print $1}') to save all the IP addresses retrieved from the arp command into a variable, ips. echo of ips gives me Address 192.168.10.100 192.168.10.101 192.168.10.1. I am assuming that Address 192.168.10.100 192.168.10.101 192.168.10.1 is saved as string in the ips variable. What I want is a way to loop through the variable ips and maybe save the one in a variable, ip, do something with it, and move to next one.
Asked by Fazle Rabbi (556 rep)
Nov 18, 2016, 03:11 PM
Last activity: Nov 5, 2024, 10:39 PM