90-display-ip 688 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. # Licence : GPL v3
  3. # Author: Laurent HUBERT
  4. #
  5. # Display connection information
  6. #
  7. IP_V4_VALUE=$(ip a | grep -v host | grep inet | grep -v inet6 | awk '{print substr($2, 1, index($2, "/")-1)}')
  8. IP_V6_VALUE=$(ip a | grep -v host | grep inet6 | awk '{print substr($2, 1, index($2, "/")-1)}')
  9. MAIN_USER_VALUE=$(id -u 1000 -n)
  10. cat <<EOF
  11. °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
  12. You can connect to this system using the
  13. following information:
  14. IPv4: $IP_V4_VALUE
  15. IPv6: $IP_V6_VALUE
  16. sudoer user: $MAIN_USER_VALUE
  17. °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
  18. EOF