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:[EMAIL PROTECTED]
Home : http://perso.LinuxFR.org/vallar/ - mailto:[EMAIL PROTECTED]
Asso : Da Linux French Team - LinuxFR - http://www.LinuxFR.org - Geek Stuff !
-= Want some woody packages on your potato, uh ? http://debian.linuxfr.org =-