#!/bin/bash
# show IP address before login

# Function to gather all non-local IPv4 addresses
gather_ips() {
    ip -o -4 addr show | awk '!/^[0-9]*: lo/ {print $4}' | cut -d/ -f1 | sort -u
}

# Remove existing IP address entries
sed -i '/^IP:/,/^$/d' /etc/issue

# Update /etc/issue with new IP addresses
gather_ips | while read -r IP; do
    echo "IP: $IP" >> /etc/issue
done
