Why all the "echo"s? :-) they don't seem to be adding anything to just having the variable there.
But anyway, I think the problem is that your first double quote in the "HOST" line is ending your MSG string.
g
-----Original Message----- From: usa ims [mailto:usaims at yahoo.com] Sent: Wednesday, September 24, 2014 14:55 To: xymon at xymon.com Subject: if statment issue on ext script
Hi,
if statement not working in my ext script. Once the script is executed, the hostname is not showing up in the MSG statement -- do you see anything obvious? I needed to 'x' out the ipaddress so my boss won't have a security panic attack.
$BBHOME/bin/bbhostgrep $TESTNAME | while read IP HOSTNAME OTHER; do if do_fetch $HOSTNAME $IP | grep "$REGEX" > /dev/null ; then
if [[ echo "$IP" =~ ^10.xxx.xxx.1[0-9] ]]; then
HOST=echo "server33.misc.corp.local"
elif [[ echo "$IP" =~ ^10.xxx.xxx.2[0-9] ]]; then
HOST=echo "server34.misc.corp.local"
elif [[ echo "$IP" =~ ^10.xxx.xxx.3[0-9] ]]; then
HOST=echo "server35.misc.corp.local"
elif [[ echo "$IP" =~ ^10.xxx.xxx.4[0-9] ]]; then
HOST=echo "server36.misc.corp.local"
elif [[ echo "$IP" =~ ^10.xxx.xxx.5[0-9] ]]; then
HOST=echo "server37.misc.corp.local"
elif [[ echo "$IP" =~ ^10.xxx.xxx.6[0-9] ]]; then
HOST=echo "server38.misc.corp.local"
elif [[ echo "$IP" =~ ^10.xxx.xxx.7[0-9] ]]; then
HOST=echo "server39.misc.corp.local"
fi
MSG=" XYMON MESSAGE
SERVER : "$HOST" ## printing blank here IPADDRESS : $IP ## ipaddress is echoing fine. "
$BB $BBDISP "status $HOSTNAME.$TESTNAME $COL $MSG"