How can I create a shell script which receives a vector argument like
./script.sh google.com,yahoo.com
and display ip for each domain
like google.com 100.23.123.13
EDIT:
#!/bin/bash
while [ "$1" ];
do
host $1 | grep address | head -1
done
How can I create a shell script which receives a vector argument like
./script.sh google.com,yahoo.com
and display ip for each domain
like google.com 100.23.123.13
EDIT:
#!/bin/bash
while [ "$1" ];
do
host $1 | grep address | head -1
done
You can use the following script:
Usage:
./script www.domain1.com domain2.com ...
For example:
You can perform multiple-query lookups directly using the
dig
command e.g.or for less verbose output
or to output just the IPs
You can do that this way.
Open a Terminal
Add the following lines into the file and Save.
Flag the script as executable
Testing
For single domain input>>
For multiple domain input>>