Handle lack of IPv6 gracefully.

This commit is contained in:
Dan Schaper 2016-09-26 18:27:02 -07:00
parent 7729ddab30
commit c41d543d81
1 changed files with 4 additions and 0 deletions

View File

@ -96,8 +96,12 @@ function ipCheck {
echo "::: Writing local IPs to logfile"
IPADDR=$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet") print $(i+1) }')
echo "$IPADDR" >> ${DEBUG_LOG}
IP6ADDR=$(ip a | awk -F " " '{ for(i=1;i<=NF;i++) if ($i == "inet6") print $(i+1) }')
if [ -n "$IP6ADDR" ]
then
echo "$IP6ADDR" >> ${DEBUG_LOG}
fi
echo >> ${DEBUG_LOG}
echo "::: Locating default gateway and checking connectivity"