Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #!/bin/ash
  2.  
  3. oldnum=meh
  4. oldinfo=""
  5. oldiface=""
  6.  
  7. ip -o addr | while read num iface stuff
  8. do
  9.  
  10. if [ "$num" != "$oldnum" ]
  11. then
  12. c=`echo $oldinfo | egrep "inet|inet6" | awk '{print $2}' | egrep -v "^f
  13. e80:" | wc -l`
  14. oldinfo="$stuff"
  15. oldnum="$num"
  16. if [ $c -gt 0 ]
  17. then
  18. case $oldiface in
  19. lo:) ;;
  20. *) echo $oldiface | cut -f1 -d:
  21. esac
  22. fi
  23. oldiface=$iface
  24. else
  25. oldinfo=`echo -e "$oldinfo\n$stuff"`
  26. fi
  27.  
  28. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement