Comment 12 for bug 1081660

Revision history for this message
Andres Rodriguez (andreserl) wrote :

hell script: (copy/paste from maas_enlist.sh)

##!/bin/sh -x

dig_output=""
ip=$(ifconfig wlan0 | awk '$1 == "inet" { sub("addr:","",$2); print $2; }') &&
     [ -n "${ip}" ] && dig_output=$(dig +short -x $ip) && host=${dig_output%.}
echo $host

-----------------------------

roaksoax@unleashed:~$ ./test.sh
+ dig_output=
+ ifconfig wlan0+
awk $1 == "inet" { sub("addr:","",$2); print $2; }
+ ip=10.0.0.175
+ [ -n 10.0.0.175 ]
+ dig +short -x 10.0.0.175
+ dig_output=;; connection timed out; no servers could be reached
+ echo

$host variable results in an empty string even if dig_output=;; connection timed out; no servers could be reached. I think this is fixed?