Получить ip сервера

IP=$(ip -4 -o addr show dev eth0 | awk '{ gsub(/\/[0-9]+$/, "", $4); print $4 }')
echo $IP