# host + whois找出某網站的資訊

執行以下命令

```
ip=host tw.yahoo.com | grep 'address' | head -1 | awk '{ print $4}'
whois $ip
```

編寫shell

```bash
#!/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 
```

./domaininfo kawsing.gitbook.io tw\.yahoo.com [www.google.com](http://www.google.com)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/andoid-shou-ji/untitled-4/shell-script/host-+-whois-zhao-chu-mou-wang-zhan-de-zi-xun.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
