#!/bin/bash h=`hostname` echo "Hostname is $h" ifconfig -a >/tmp/ip.tmp for eth in `grep ‘Link encap:‘ /tmp/ip.tmp|awk ‘{print $1}‘` do ip=`grep -A1 "$eth" /tmp/ip.tmp|tail -1 |awk ‘{print $2}‘|sed ‘s/addr://‘` echo $eth":"$ip done echo "The DNS IP is:" grep ‘nameserver‘ /etc/resolv.conf|awk ‘{print $2}‘
时间: 2024-10-18 10:51:11