#! /bin/bash

function Choose_entree
{
	echo
	PS3="Choose your Entree: "
	select meat
	do
		entree="$meat"
		case $REPLY in
			1 | 2 | 3 )
				PS3="How would you like that cooked? "
			#	Choose_cooked
				Choose_an_item Rare Medium\ Rare Medium Medium\ Well Well\ Done
				return
				;;
			4 | 5 | 6 )
				return
				;;
			* )
				entree="No entree"
				return
				;;
		esac
	done
}

#
#  The following function is no longer used,
#  Replaced by a call to "Choose_an_item" in function "Choose_entree"
#

function Choose_cooked
{
	echo
	select cooked in Rare Medium_Rare Medium Medium_Well Well_Done
	do
		case $cooked in
			Rare )
				entree="$entree, Rare"
				return 1
				;;
			Medium_Rare )
				entree="$entree, Medium Rare"
				return 2
				;;
			Medium )
				entree="$entree, Medium"
				return 3
				;;
			Medium_Well )
				entree="$entree, Medium Well"
				return 4
				;;
			Well_Done )
				entree="$entree, Well Done"
				return 5
				;;
		esac
	done
}

function Choose_an_item
{
	echo
	select item 
	do
		entree="$entree, $item"
		return $REPLY
	done
}

#  Main script begins here

entree=""

Choose_entree Sirloin Rib\ Eye Tenderloin Fried\ Chicken Fried\ Fish Pork\ Chops

PS3="Choice of Potato? "
Choose_an_item Baked\ Potato French\ Fries Mashed\ Potatoes No\ Potato

PS3="Choice of Vegetable? "
Choose_an_item Green\ Beans White\ Beans Broccoli Tossed\ Salad Caesar\ Salad No\ Vegetable

if [ $? -eq 4 ]
then
	PS3="What kind of Dressing? "
	Choose_an_item French Ranch Blue\ Cheese Thousand\ Island Italian
fi

PS3="What to drink? "
Choose_an_item Iced\ Tea Sweet\ Tea Soda Water Water\ with\ Lemon

echo
echo "You chose $entree."
echo "I hope you enjoy your meal."
echo

 
	
