1 |
On Tue, 11 Dec 2012 19:33:15 +0800 |
2 |
Bill Kenworthy <billk@×××××××××.au> wrote: |
3 |
|
4 |
> For years I have been using ifconfig and some simple shell magic to |
5 |
> extract the ip address from the adsl ppp session when it changes. The |
6 |
> latest update has changed the output format of ifconfig breaking |
7 |
> things so if ifconfig cant be relied on, what's normally used to |
8 |
> extract an interfaces IP address? I can easily rewrite the shell |
9 |
> magic, but its worth asking if there is some command better suited. |
10 |
> |
11 |
> BillK |
12 |
> |
13 |
> |
14 |
> |
15 |
|
16 |
ip tends to be a little more consistent and a little more |
17 |
script-friendly than ifconfig: |
18 |
|
19 |
ip -o addr show |
20 |
|
21 |
-o prints output on one line, making your subsequent grep, sed and |
22 |
awking easier |
23 |
|
24 |
-- |
25 |
Alan McKinnon |
26 |
alan.mckinnon@×××××.com |