Only display an ipv6 address if it exists

This commit is contained in:
Bob Mottram 2016-10-19 15:24:44 +01:00
parent 766fe08689
commit b1d4d9bba1
1 changed files with 6 additions and 1 deletions

View File

@ -368,7 +368,12 @@ function show_ip_addresses {
echo 'IP/DNS addresses'
echo '================'
echo ''
echo "IPv4: $(get_ipv4_address) IPv6: $(get_ipv6_address)"
echo -n "IPv4: $(get_ipv4_address)"
ipv6_address="$(get_ipv6_address)"
if [ ${#ipv6_address} -gt 0 ]; then
echo " IPv6: $(ipv6_address)"
fi
echo ''
echo ''
}