Untitled
By: a guest | Mar 6th, 2010 | Syntax:
None | Size: 1.04 KB | Hits: 110 | Expires: Never
#!/bin/bash
#####################
# Settings
#####################
### regexp for IP search (first octect of IP addresses should be sufficient) ###
### to search multiple subnets use the infix operator | such as:
#IPSEARCH="147|64"
#IPSEARCH="190|200";
#IPv6 use the first few digits like so...
IPSEARCH="2001:470:";
### colors ###
#title color
COL1="\x1b[0;31;40m";
#ip color
COL2="\x1b[0;32;40m";
#'=' color
COL3="\x1b[0;34;40m";
#domain color
COL4="\x1b[0;33;40m";
#error color
COL5="\x1b[0;31;40m";
#colors off (back to natural terminal colors)
COLOFF="\x1b[0;37;00m";
### footer (Displayed at end of list) ###
FOOTER="Enjoy!"
### Command paths ###
IFCONFIG="/sbin/ifconfig";
GREP="/bin/grep";
AWK="/usr/bin/awk";
HOST="/usr/bin/host";
##################
#Code goes here
##################
HOSTNAME=`hostname`;
echo -en "$COL1 Hostnames for $HOSTNAME\n";
for tip in `$IFCONFIG | $GREP inet | $AWK '{print $2}' | $GREP -E "$IPSEARCH"`;
do
IFS=":"
zip=($tip);
ip=${zip[1]};
echo -ne "$COL2$ip $COL3=";