linux-l: Anzeige der aktuellen IPnummer - "host `hostname`"

Alexander Stielau aleks at sailtraining.de
Fr Apr 13 11:11:05 CEST 2001


Am Fre, Apr 13, 2001 at 03:34:00 +0200 schrieb Sven Guckes:

> Aber es stimmt natuerlich - die aktuelle IP bekomme ich darueber
> natuerlich nicht.  Da ist "ifconfig" schon besser.  Warum nur hat
> "ifconfig" keinen parameter fuer eine gezielte Abfrage? *grummel*

#!/bin/sh
# ip.sh
# (c) Aleks für Sven.
# WARNING: this is BAD software
#
# purpose: get the (dynamic) ip-number of the ppp0 device 
#          on modem or dsl links.
# version: 0.1
#
# history: 0.1 initial version 01-04-13; codname crossingday

# Helperapplications
IFCONFIG="`which ifconfig`"
AWK="`which awk`"
SED="`which sed`"

if [ $# -ne 0 ] ; then
    echo "Usage: $0 "
    echo ""
    echo "no further options required"
    echo ""
    exit 1
else
IP=`$IFCONFIG ppp0 | $AWK '/inet addr:/ {print $2}'| $SED 's/addr://'`

echo $IP

fi
exit 0

Grüße,   
Aleks  



Mehr Informationen über die Mailingliste linux-l