remove the square brackets from IP in a oneliner (#1620)

This commit is contained in:
PatrickScheich 2020-10-05 22:48:10 +02:00 committed by GitHub
parent 8dc0346e62
commit c6654235cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,12 +149,8 @@ if [ ${runGlobal} -eq 1 ]; then
##########################################
# Clean IP
# really just the IP value - without the default brackets if IPv6
has_brackets="$(echo "${publicIP}" | grep -c '\[')"
if [ ${has_brackets} -eq 0 ]; then
cleanIP="${publicIP}"
else
cleanIP="$(echo "${publicIP}" | cut -d'[' -f2 | cut -d']' -f1)"
fi
# for IPV4 case the "tr" will do no harm.
cleanIP=$(echo "${publicIP}" | tr -d '[]')
fi