nested loop

I have two do loops. When I break of the inner loop it doesn't go back to the outer loop but exit the program.

Please post your code. Also, post which shell and OS you are using.

Korn shell on a HP but the code will also run on AIX.
The code is very big but here is the piece that is not working

if [ "${ALERT}" ]
then
  set -x
  desc="performing maintenance on the Oracle alerts logs."
  echo "\n${desc}\n" >> ${logfile}

  export dblist=$(grep -v "#" ${oratab} | awk -F: '{print $1}')
  echo "${dblist}" | while read db
  do
    while true
    do
      export sid=${db}
      alertlog="alert_${sid}.log"
      echo "\nprocessing ${alertlog}." >> ${logfile}
      orauser=${admin}/${sid}/.orauser_${sid}
      if test ! -r "${orauser}"
      then
        errmsg=${main}.${today}.msg
        echo "unable to read ${orauser}" > ${errmsg}
        send_message ${maillist} ${errmsg}
        echo "\nunable to read ${orauser}." >> ${logfile}
        break
      fi
      . ${admin}/${sid}/.orauser_${sid}
      echo "\nsql query for background_dump_desc from ${sid}." >> ${logfile}
      sqlcmd=${workdir}/${main}.alertlog.${today}.sql
      sqllog=${workdir}/${main}.alertlog.${today}.log
      rm -f ${sqlcmd} ${sqllog}
      echo "set termout off" > ${sqlcmd}
      echo "set pagesize 0" >> ${sqlcmd}
      echo "set linesize 1024" >> ${sqlcmd}
      echo "set trimspool on" >> ${sqlcmd}
      echo "set heading off" >> ${sqlcmd}
      echo "set feedback off" >> ${sqlcmd}
      echo "set verify off" >> ${sqlcmd}
      echo "whenever sqlerror warning" >> ${sqlcmd}
      echo "spool ${sqllog}" >> ${sqlcmd}
      echo "select value from v\$parameter" >> ${sqlcmd}
      echo "  where name = 'background_dump_dest';" >> ${sqlcmd}
      echo "exit" >> ${sqlcmd}
      systempwd=$(get_pwd ${node} ${sid} system)
      (sqlplus -S system/${systempwd} @${sqlcmd}) >> ${logfile}
      if [ "${status}" -ne 0 ]
      then
        errmsg=${main}.${today}.msg
        echo "error ${status} retriving background_dump_dest \c" >> ${logfile}
        echo "from ${sid}." > ${errmsg}
        send_message ${maillist} ${errmsg}
        echo "error ${status} retriving background_dump_dest \c" >> ${logfile}
        echo "from ${sid}." >> ${logfile}
        break
      fi
      bdump=$(cat ${sqllog})
      echo "\nsqlplus query successful. bdump = ${bdump}\n" >> ${logfile}
      rm -f ${sqlcmd} ${sqllog}
      timestamp=$(gettimestamp)
      archive="${alertlog}.${timestamp}"
      cp -fp ${bdump}/${alertlog} ${bdump}/${archive}
      echo "\narchiving ${alertlog} to TSM." >> ${logfile}
      archive_file ${bdump} ${archive} ${mca}
      status=$?
      if [ "${status}" -ne 0 ]
      then
        errmsg=${main}.${today}.msg
        echo "error ${status} archiving ${archive} to TSM." > ${errmsg}
        send_message ${maillist} ${errmsg}
        echo "error ${status} archiving ${archive} to TSM." >> ${logfile}
        echo "restoring ${alertlog} to original state." >> ${logfile}
        tmpfile=${workdir}/${main}.tmp
          
        cmd="cat ${bdump}/${archive} ${bdump}/${alertlog} > ${tmpfile}; "
        cmd="${cmd} mv -f ${tmpfile} ${bdump}/${alertlog}; "
        cmd="rm -f ${bdump}/${archive} ${tmpfile}"
        (${cmd})
        break
      fi
      rm -f ${bdump}/${archive}
      echo "\ntruncating file ${bdump}/${alertlog}" >> ${logfile}
      truncate_file ${bdump}/${alertlog}
      status=$?
      if [ "${status}" -ne 0 ]
      then
        errmsg=${main}.${today}.msg
        echo "error ${status} truncating ${bdump}\c" > ${errmsg}
        echo "/${alertlog}." >> ${errmsg}
        send_message ${maillist} ${errmsg}
        echo "error ${status} truncating ${bdump}/\c" >> ${logfile}
        echo "${alertlog}." >> ${logfile}
        continue
      fi
      echo "\nfile truncated successfully.\n" >> ${logfile}
      break
    done
  done
fi

I would like to see printing dblist after the following line
to see what it is printing and whether dblist is just a single line.

 export dblist=$(grep -v "#" ${oratab} | awk -F: '{print $1}')

Also print some log between those 2 'done' statements and see whether it is printed or not.

done
done

export dblist=$(awk -F: '/^[^#].*/ {print $1}' ${oratab})

Thank you for all your help I change the command line and work fine. I don't now how this work but if you can explain to me why this command works and not the original one will be helpfull. Thank you again