#!/usr/bin/env bash menu () { while [ active=1 ]; do title echo "Please select a Entry" echo "" shopt -s nullglob moduleCat=(./modules/*) x=0 for entry in "${moduleEnt[@]}"; do if [[ -d $entry ]]; then echo "$x:d - $entry" else [[ -f $entry ]]; then echo "$x:f - $entry" fi x=$((x+1)) done echo "exit" read opt exitchk entSelect=`echo ${moduleEnt[$opt]} | sed 's|./modules/|../|'` submenu clear done } submenu () { clear while true; do title echo "Please select an Option from the $entSelect Category" echo "" shopt -s nullglob moduleOpt=($moduleEnt[$opt]) x=0 for module in "${moduleOpt[@]}"; do echo "$x - $module" x=$((x+1)) done echo "back" read opt exitchk clear done }