Browse Source

Add eeip; a bief IP address lister

Alois Mahdal 10 years ago
parent
commit
c819f78eda
2 changed files with 31 additions and 0 deletions
  1. 30
    0
      bin/eeip
  2. 1
    0
      setup/mk.sh

+ 30
- 0
bin/eeip View File

1
+#!/bin/bash
2
+
3
+. <(ffoom init)
4
+
5
+ffoo import core
6
+ffoo import types
7
+
8
+mkbrief() {
9
+    local line ifno maybe_ifno ifname ipinfo
10
+    while read line;
11
+    do
12
+        maybe_ifno=${line%%:*}
13
+        debug -v maybe_ifno
14
+        if is_integer "$maybe_ifno";
15
+        then
16
+            ifno=$maybe_ifno
17
+            ifname=${line##$ifno: }
18
+            ifname=${ifname%%:*}
19
+            debug -v ifno ifname
20
+        elif grep -qs '^inet ' <<<"$line";
21
+        then
22
+            ipv4=${line##inet }
23
+            ipv4=${ipv4%% *}
24
+            debug -v ipv4
25
+            printf "%-7s %s\n" $ifname $ipv4
26
+        fi
27
+    done
28
+}
29
+
30
+ip addr show | mkbrief

+ 1
- 0
setup/mk.sh View File

15
     echo bin/eeget
15
     echo bin/eeget
16
     echo bin/eeiam
16
     echo bin/eeiam
17
     echo bin/eeini
17
     echo bin/eeini
18
+    echo bin/eeip
18
     echo bin/eeln
19
     echo bin/eeln
19
     echo bin/eepush
20
     echo bin/eepush
20
     echo bin/eerevert
21
     echo bin/eerevert