Shell Script Re-Entrant Menu Demo
Here is one way to do a simple commands menu for your programs
VERY SIMPLE RE-ENTRANT MENU PROGRAM
=========== START ==========
#!/bin/sh
#
# Re-entrant Menu Layout
#
# Arv Evans K7HKL
# 1 January, 2007
#
# This is FREEWARE.
# You can copy it, use it, modify it, etc. without any licensing issues.
# If you break it, you own it...you fix it!
#
while true
do
clear
echo "#====================================#"
echo "# Re-Entrant Menu Demo #"
echo "#------------------------------------#"
echo "# 1) First Task #"
echo "# 2) Second Task #"
echo "# 3) Third Task #"
echo "# 4) Fourth Task #"
echo "# q) Exit #"
echo "#------------------------------------#"
echo -n "# Selection: "
read selection
case $selection in
1) # put your own code for task-1 here.
clear
echo "You have selected task #1"
echo -n "Hit ENTER To Continue: "
read junk
;;
2) # put your own code for task-2 here.
clear
echo "You have selected task #2"
echo -n "Hit ENTER To Continue: "
read junk
;;
3) # put your own code for task-3 here.
clear
echo "You have selected task #3"
echo -n "Hit ENTER To Continue: "
read junk
;;
4) # put your own code for task-4 here.
clear
echo "You have selected task #4"
echo -n "Hit ENTER To Continue: "
read junk
;;
q|Q|0) # Exit on q, Q, or 0 entry
exit
;;
*) # Wildcard '*' is catchall for undefined command entries
echo
echo "Illegal Command in '$selection'"
echo -n "Hit ENTER To Continue: "
read junk
;;
esac # end of "case" evaluations
done
=========== END ===========