#!/usr/bin/bash

. '/etc/os-release'

CU='\033[4m'    # underline
C0='\033[0m'    # clear
C1='\033[31m'   # red
C2='\033[32m'   # green
C3='\033[33m'   # yellow
C4='\033[91m'   # orange
C5='\033[34m'   # blue

HOSTNAME=$(/usr/bin/hostname)
IP4=($(/usr/bin/ip -family 'inet' address | /usr/bin/grep 'scope global' | /usr/bin/mawk '{print $2}'))
IP6=($(/usr/bin/ip -family 'inet6' address | /usr/bin/grep 'scope global' | /usr/bin/mawk '{print $2}'))
BRTX_ETH0=$(/usr/bin/networkctl status 'eth0' | /usr/bin/grep --word-regexp 'Bit Rate (Tx/Rx):' | /usr/bin/sed --expression='s/.*Bit Rate (Tx\/Rx):[[:space:]]//' --expression='s/\/.*//')
BRRX_ETH0=$(/usr/bin/networkctl status 'eth0' | /usr/bin/grep --word-regexp 'Bit Rate (Tx/Rx):' | /usr/bin/sed --expression='s/.*Bit Rate (Tx\/Rx):[[:space:]]//' --expression='s/.*\///')

/usr/bin/echo -e "\t${C3}Hostname:${C0}\t\t\t\t\t${HOSTNAME}"
for IP4 in "${IP4[@]}"; do
  /usr/bin/echo -e "\t${C3}IPv4-Address:${C0}\t\t\t\t\t${IP4}"
done
for IP6 in "${IP6[@]}"; do
  /usr/bin/echo -e "\t${C3}IPv6-Address:${C0}\t\t\t\t\t${IP6}"
done
/usr/bin/echo -e "\t${C3}Bit Rate (Tx/Rx) [eth0]:${C0}\t\t\t${BRTX_ETH0} / ${BRRX_ETH0}"
