0
我有很多虚拟服务器与静态IP地址,并与他们的A记录。我应该使用关联数组来安装我的CMS。但我有想法。也许我应该使用挖,或其他dnsutil的? 所以,我开始写:通过nslookup命令搜索我自己的IP地址从许多其他ip
start=test
dns=com
for i in "${start}" {1..20}."$dns"; do
echo $i >> "/tmp/temp"
done
for ns in `cat /tmp/temp`; do
if [[ `dig +short $ns=="192.168.110.1"` ]]; then
dig +short $ns
fi
done
但我的第二个循环是错误的。你可以帮我吗 ? 我应该生成一个列表与我的域名,如test1.com,test2.com ... 然后,我应该得到IP地址。下一步将比较我的系统IP,如果我有IP 192.168.110.1,我应该得到我的域名,如test2.com。它不工作,我打破了我的头,但我不知道,如何做到这一点。请帮助,如果可能的话。
'{1..20}'括号扩展只是Bash。你可以用'seq 1 20 |'替换'for'循环同时阅读我;做',然后脚本也会'sh'兼容。 – tripleee