[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: How to get current IP adress ?
From: "Andrew Morton" <morton () nortelnetworks ! com>
Date: 1999-10-03 15:29:00
[Download RAW message or body]
Markus Goetz wrote:
>
> Hi,
>
> how can i get the current ip adress of the user when he is online ?
As has been pointed out, this is tricky. A machine can have any number
of IP addresses, even if it has only one interface; which do you want?
If it's specifically dialup, and you're after the IP address of the
first modem connection then:
#!/bin/sh
if ppp-is-up
then
ppp_to_ip
fi
> cat ppp-is-up
#!/bin/sh
exec ifconfig | grep ppp > /dev/null
> cat ppp_to_ip
#!/bin/sh
ifconfig -i ppp0 | head -2 | tail -1 | sed -e "s/[^0-9]*//" | sed -e "s/
.*//"
These will probably only work for Linux.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic