X-Git-Url: https://iankelling.org/git/?p=automated-distro-installer;a=blobdiff_plain;f=chost;h=a26529fee9efbeaf3a14632946d59d4e84d7bc8d;hp=c02c8c2595a3483117e62bc212237bec5a67a0db;hb=c47175685b348735b3440e16851dde2cc39b6f3f;hpb=ac4e0089e245c96a388b8fcdd92fc05da3399694 diff --git a/chost b/chost index c02c8c2..a26529f 100755 --- a/chost +++ b/chost @@ -7,7 +7,9 @@ set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR host=$1 -addr=$(host $host | sed -rn 's/^\S+ has address //p;T;q') +# ||: because if we are using 2+ resolvers, 1 may fail, causing error, but we still get +# a valid address and we just use that +addr=$(host $host | sed -rn 's/^\S+ has address //p;T;q' ||:) h=$(host $addr) h=${h##* } echo $h