1
我创建基于我能找到在互联网和一些的bash教程的脚本,这会告诉我我的外部IP,它的分布于全国。国家和外部IP bash脚本
#脚本如下像这样:
#!/bin/bash
wanip=$(dig +short myip.opendns.com @resolver1.opendns.com);
echo "$wanip" > /root/Documents/filewanip;
iplist="/root/Documents/filewanip"
while read IP;do
whois "$IP"
done < "$iplist" | grep "country" >geoloc
cat geoloc filewanip
rm filewanip geoloc
#
输出看起来是这样的: 国家:荷兰 183.64.132.80
#问题是我不想使用文件来做到这一点,因为文件结构明显从系统变为系统。 如何以优雅的方式制作它,以便进行检查并存储到变量中,然后直接显示在shell中?
约翰·康纳
John1024这正是我所需要的。你先生配有饼干! 我需要开始学习awk和sed,现在推迟一段时间。 不能把你的投票该死的,我要低排名:( –