What i need to do is when the database connection is not successful , the script should move to next list i.e skip the current.
But when i do this -
if [ "$NO" -eq "1" ]; then
break;
fi
The script break but it goes to the condition -
if [ $COUNT -ne 0 ]; then
for LIST in $LISTS
do
for TABLE in $TABLES
do
COUNT=`/usr/local/sybase1251/OCS-12_5/bin/isql -S $LIST-U user -P pass-w 100 <<EON | egrep -v -e '-----------' | egrep -v -e 'affected'
select count(*) from Table
go
EON`
NO=`echo $COUNT | grep "CT-LIBRARY error" | wc -l `
echo $NO
if [ "$NO" -eq "1" ]; then
break;
fi
if [ $COUNT -ne 0 ]; then
\#TABLES="$CLIENT $TABLE $COUNT\\n"$TABLES
fi
done
done
How can i get this working ?