shell regex matching help

Neil Watson tlug-neil-8agRmHhQ+n2CxnSzwYWP7Q at public.gmane.org
Tue Dec 12 17:40:54 UTC 2006


I need help with this script.

#!/bin/bash

HOSTNAME=`hostname`
SERVICE="db2"
CLUSTAT=`/usr/sbin/clustat -s ${SERVICE}|tail -n1`
# Should return:
  #db2                  your-hostname                 started

echo $HOSTNAME
echo $SERVICE
echo $CLUSTAT

if [[ ${CLUSTAT} = ${SERVICE}[:blank:]+${HOSTNAME}[:blank:]+started ]] ; then
        echo "Node is active"
        exit 0;
fi

# Else node is not active.
echo "Node is not active"
exit 255

Output:
:!./activenode
tor-lx-hadrian
db2
db2 tor-lx-hadrian started
Node is not active

Why is the match failing?

-- 
Neil Watson             | Debian Linux
System Administrator    | Uptime 38 days
http://watson-wilson.ca
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list