From 23a4e615799cb6464f8da1b6fbca0a9fe5ca53e1 Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Wed, 5 Apr 2023 21:22:49 +0900 Subject: [PATCH] improve ip check logic --- Linux_reinstall/updatemotd/10-sysinfo | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Linux_reinstall/updatemotd/10-sysinfo b/Linux_reinstall/updatemotd/10-sysinfo index 8bfe048..f4bbad3 100644 --- a/Linux_reinstall/updatemotd/10-sysinfo +++ b/Linux_reinstall/updatemotd/10-sysinfo @@ -82,13 +82,9 @@ if [[ `echo "$IPv6" | grep -i '[[:xdigit:]]' | grep ':'` ]] && [[ "$IP6_Hex_Num" IP6_Check="isIPv6" fi -if [[ "${IP6_Check}" != "isIPv6" ]] && [[ -z ${IPv6} ]]; then - IPv6="N/A" -fi +[[ "${IP6_Check}" != "isIPv6" ]] && IPv6="N/A" -if [[ "${IP_Check}" != "isIPv4" ]] && [[ -z ${IPv4} ]]; then - IPv4="N/A" -fi +[[ "${IP_Check}" != "isIPv4" ]] && IPv4="N/A" if [[ "${localip}" == "${IPv4}" ]] || [[ "${localip}" == "${IPv6}" ]]; then # localip=`ip -o a show | grep -w "lo" | grep -w "inet" | cut -d ' ' -f7 | awk '{split($1, a, "/"); print $2 "" a[1]}'`