# on our systems) or to 127.0.1.1 if not. On the reasoning for separating
# localhost and hostname mapping to different IPs, see
# <https://unix.stackexchange.com/a/13087>.
+#
+# Ignores IPv6s.
set -e
hostname="$1"
final_ip="127.0.1.1"
for ip in $(hostname -I); do
+ if [ $(echo "${ip}" | grep ':' | wc -l) -eq 1 ]; then
+ continue
+ fi
range_1=$(echo "${ip}" | cut -d "." -f 1)
range_2=$(echo "${ip}" | cut -d "." -f 2)
if [ "${range_1}" -eq 127 ]; then