I have a list file that contains server names and IP addresses. How would I go about reading each line, and separating it into two variables that will be used to complete other commands?
Sample in MyList:
server01.mydomain.com 192.168.0.23
server02.testdomain.com 192.168.0.52
intended script
#!/bin/bash
MyList="/home/user/list"
while read line
do
echo $line #I see a print out of the hole line from the file
"how to make var1 ?" #want this to be the hostname
"how to make var2 ?" #want this to be the IP address
echo $var1
echo $var2
done < $MyList