You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
container-overlay/scripts/functions/ip.sh

11 lines
239 B

#!/bin/bash
# Define the IP address
interface=$(ip route | grep -m 1 'default via' | awk '{print $5}')
if [[ -z $interface ]]
then
interface=eth0
fi
IP=$(ifconfig $interface 2>/dev/null | grep 'inet ' | awk '{print $2}')
echo $IP