ip=host tw.yahoo.com | grep 'address' | head -1 | awk '{ print $4}'
whois $ip
#!/bin/bash
#取得所有參數
domarg=$@
[ $# -eq 0 ] && { echo "使用: $0 domain1.xxx domain2.xxx ..."; exit 1; }
for dom in $domarg
do
echo "--------------- $dom 的資訊----------------"
echo ""
ip=$(host $dom | grep 'address' | head -1 | awk '{ print $4}')
[ "$ip" == "" ] && { echo "Error: $dom 不存在或dns解析有誤 ."; continue; }
echo "取得資訊中....=>$dom [ $ip ]"
whois "$ip"
echo "----------------end-----------------"
done