Function returns wrong values - solved

Hi

I have a small function which returns a wrong value.
The function tries to make a connection to oracle database and tries to get the open_mode of the database in the variable status.

However when a database is down the value of the status column is set to READWRITE i am not sure why.

I also unset the status variable still no luck

Any ideas ?

get_db_status() {
unset status
echo "Entering DB STATUS scripts"
sid=$1
echo $sid
if ! check_sqlplus  "$sid" ; then
  echo "Unable to use sqlplus for sid $sid"
  return 1
else
  echo "attempting to connect to database"
  echo $status
  echo $ORA_HOME
  echo "Status before entering sqlplus is $status"
  status=`sqlplus -silent "/ as sysdba" <<EOF
  conn /as sysdba
  set pagesize 0 feedback off verify off heading off echo off
  select replace(open_mode,' ','')
  from v\\$database;
  exit;
EOF`
echo "current status is $status"
fi

---------- Post updated at 02:56 PM ---------- Previous update was at 01:33 PM ----------

Hi

Apologies i found my faux pause
Friday evening i had a brain fart

regards