Dynamic Menu Help

I'm working on a menu to read folders in as menu selections then CD to the selected folder and display the contained files as menu selections for execution.

I'm using the following to read in the file list but I get lost after that.
I only read in files that begin with CAPs. The problem is when I quit from the file menu it doesn't re-display the top level folder menu and reset PS3.

Thanks!

#!/bin/ksh
#

PS3="Select System Type>"

select FILE in [A-Z]* QUIT
do
if [ -e $FILE ] ; then
cd $FILE

PS3="Select Test to Run>"
select TEST in [A-Z]* QUIT
do
if [ -e $TEST ] ; then
./$TEST
else
break
fi
done
else
break
fi
done

I don't know exactly how your script is intended to work, but I wrote an example script to demonstrate traversing hierarchical menu choices. Maybe it will help (no guarantees that you can't break the script; it makes assumptions).

#!/usr/bin/ksh
# The quick brown fox jumps over the lazy dog

set -A animalname "fox" "dog"
set -A foxadject "quiet brown" "quick brown" "lazy brown" "quick red" "red slow"
set -A dogadject "slow" "quiet" "sleeping" "lazy" "brown"
set -A action "jump" "run" "skip" "hop" "roll"

until [[ -n $animal && -n $foxadj && -n $dogadj ]]
 do
  clear
  choice=1
  print "\nPlease select an animal.\n"
  select animal in ${animalname[*]}
   do
    choice=2
    print "\nPlease select a description for the $animal.\n"
    case $animal in
      fox)
        select foxadj in "${foxadject[@]}"
         do
          break $choice
        done
        ;;
      dog)
        select dogadj in "${dogadject[@]}"
         do
          break $choice
        done
        ;;
    esac
    break $choice
  done
done

until [[ -n $verb ]]
 do
  print "\nPlease select an action.\n"
  select verb in "${action[@]}"
   do
    break
  done
done

print "\nThe $foxadj fox ${verb}s over the $dogadj dog.\n"

Nice program but the 'choices' are embedded in the script. I want to be able to add files to be executed to the menu simple by placing them in the folder instead of hard coded in the script. I didn't want to have to edit the script everytime a test is added.

What I've got reads the top level folders into the menu.

1)Folder1
2)Folder2
3)QUIT
Select System Type>

Once a choice is made here the next menu display the available filelist for execution in that folder.

1)Script1
2)Script2
3)Script3
...
7)Script7
8)QUIT
Select Test to Run>

The problem is when I 'QUIT' from menu 2 I still get menu2 prompt but it's actually at menu1. It doesn't display menu1 either. Simply:

Select Test to Run>

maybe something like this:

#!/bin/ksh

type_prompt='Select System Type> '
PS3="${type_prompt}"

file_choices=[A-Z]*
select FILE in ${file_choices} QUIT
do
   if [ -e $FILE ] ; then
     cd $FILE

     PS3="Select Test to Run>"
     select TEST in [A-Z]* QUIT
     do
        if [ -e $TEST ] ; then
          ./$TEST
        else
          cd ..
          PS3="${type_prompt}"
          break
        fi
     done
  else
     break
  fi
  # added to display  the OUTTER menu
  REPLY=''
done