Re: Adresse IP temporaire ?
On Tue,Mar,27,2001, Guillaume Morin wrote:
> [...]
> Pour une connexion intermittente, il y a de grandes chances pour qu'elle
> soit très différente. Pour une connexion presque permanente, tu peux
> garder la même IP pendant pas mal de temps.
>
> > - si oui, comment la connaître (à partir d'un programme C ou C++, ou à partir
> > d'un script) ?
>
> ifconfig | grep -A1 ppp0 | tail -1 | cut -d : -f2 | sed "s/ .*//"
>
> Ce truc que j'ai fait en 20 secs chrono, te file ton addresse ip.
>
Variantes :
/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d \ -f 1
(à coup de cut)
ou
/sbin/ifconfig eth0 | grep inet | awk '{ print $2 }' | awk -F: '{print $2}'
(à coup de awk)
Moi je ne les ai pas faites, je les ai repompés... comme d'hab.
Val.
--
Laurent Vallar aka Val - Manager of Architecture and Software Development Dep.
Work : http://SecurityKeepers.com - mailto:Laurent.Vallar@SecurityKeepers.com
Home : http://perso.LinuxFR.org/vallar/ - mailto:Laurent.Vallar@LinuxFR.org
Asso : Da Linux French Team - LinuxFR - http://www.LinuxFR.org - Geek Stuff !
-= Want some woody packages on your potato, uh ? http://debian.linuxfr.org =-
Reply to: