#!/bin/bash
#
# Author: [email protected]
#
# /usr/local/bin/getip
#
# Version: 7.3.1
#
# Requires: ifconfig
#
# Public: yes
# Copyright (C) 2002 "Dirk-Lueder Kreie"
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the
#
# Free Software Foundation, Inc.
# 59 Temple Place, Suite 330
# Boston, MA 02111-1307
# USA.
export LC_ALL=C
if [ -n "$1" ]; then
EXT_IF="$1"
for IP_PARAM in `/sbin/ifconfig $EXT_IF | grep inet`; do
if [ `echo $IP_PARAM |grep -c addr` -gt 0 ]; then
IP_PARAM=${IP_PARAM##addr\:}
echo $IP_PARAM
fi
done
else
EXT_IF=ppp0
for IP_PARAM in `/sbin/ifconfig $EXT_IF | grep inet`; do
if [ `echo $IP_PARAM |grep -c addr` -gt 0 ]; then
IP_PARAM=${IP_PARAM##addr\:}
echo ${EXT_IF}: $IP_PARAM
fi
done
nslookup deelkar.ath.cx ines.zfn.uni-bremen.de|grep Address: | tail -n1 | sed -e 's/.*:/deelkar.ath.cx:/g'
nslookup deelkar.yi.org ines.zfn.uni-bremen.de|grep Address: | tail -n1 | sed -e 's/.*:/deelkar.yi.org:/g'
nslookup deelkar.3-a.net ines.zfn.uni-bremen.de|grep Address: | tail -n1 | sed -e 's/.*:/deelkar.3-a.net:/g'
fi