#! /bin/sh # This script will attempt to find and print # 1. the host name # 2. the IP address # 3. The host id (Solaris) or the ethernet address (FreeBSD, Linux) # No copyright, public domain hostname=`hostname` echo Your host name is: $hostname ip=`/usr/sbin/traceroute $hostname 2>&1 | grep traceroute | sed s/.*\(// | sed s/\).*//` echo Your IP address is: $ip if [ `uname` = "SunOS" ]; then echo Your Host ID is: `hostid` else if [ -x /sbin/ifconfig ]; then ifc=/sbin/ifconfig elif [ -x /usr/sbin/ifconfig ]; then ifc=/usr/sbin/ifconfig elif [ -x /bin/ifconfig ]; then ifc=/bin/ifconfig elif [ -x /usr/bin/ifconfig ]; then ifc=/usr/bin/ifconfig else exit 1 fi if [ `uname` = Linux ]; then hw=`$ifc -a | grep HWaddr | sed s/"^.*HWaddr *"//` else hw=`$ifc -a | grep ether | sed s/"^.*ether *"//` fi fi if [ x"$hw" != x ]; then set $hw echo Your ethernet address is: $1 fi