shell_script_查询主机名、ip地址 、DNS地址
#!/bin/bash
hostname
ip=`/sbin/ifconfig eth0|grep "inet addr:"|sed 's/Bcast.*$//'g |awk -F ":" {'print $2'}`
dns=`cat /etc/resolv.conf |grep -v '#'|sed 's/nameserver//'`
for i in $ip
do
echo "$i"
done
for a in $dns
do
echo "$a"
done