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