I wanna convert a list of domain to the IP address using bash scripts in OSX.
I created a list file to present the domain line by line like this
www.google.com
www.yahoo.com
www.facebook.com
I used the following scripts to lookup the IP address:
#!/bin/bash
while read -r domain
do
echo `dig +short $domain`
done < list
where list is a file that contains those domain.
However, it end up only show a empty string.
But when I only query one domain, the command is okay.
dig +short www.google.com
> 216.58.221.132
Hope anyone can help me to figure out the problem. Thanks!