Gentoo Archives: gentoo-user

From: Ricardo Saffi Marques <saffi@××××××××××××××.br>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Finding local IPs
Date: Thu, 25 Oct 2007 19:18:32
Message-Id: 3b5772b30710251212k4b4c7d70y6b4c52087baa7301@mail.gmail.com
In Reply to: [gentoo-user] Finding local IPs by Bertram Scharpf
1 Hi Bertram.
2
3 I've tried some stuff here and ended up with this:
4
5 ifconfig | egrep "inet addr" | cut -d ":" -f 2 | cut -d " " -f 1
6
7
8 It's not pretty, but certainly works.
9
10 Regards,
11
12 Saffi
13
14 On 10/25/07, Bertram Scharpf <lists@×××××××××××××××.de> wrote:
15 >
16 >
17 > Hi,
18 >
19 >
20 > in some script I need all the local IP addresses of a host,
21 > as there are 127.0.01, 192.168.8.1, ...
22 >
23 > I can do this using the command suite
24 >
25 > LANG= /sbin/ifconfig | awk '/\<inet\>/{split($2,a,":");print a[2]}'
26 >
27 > As this is quite long I would like to ask whether there is
28 > some smarter way to do it.
29 >
30 > Thanks in advance,
31 >
32 > Bertram Scharpf
33
34
35 --
36 *Ricardo Saffi Marques*
37 Laboratório de Administração e Segurança de Sistemas (LAS/IC)
38 Universidade Estadual de Campinas (UNICAMP)
39 *Cell:* +55 (19) 8128-0435
40 *Skype:* ricardo_saffi_marques
41 *Website:* *http://www.rsaffi.com*