I have a program that works fine but I need it to not exit after a choice is made. Ideally after one choice is made the command will execute, and then the menu will pop back up asking the user to enter another choice. I know I will need to use some kind of loop for this, but I'm very new to bash scripting and couldn't find much help online / in my book. Here is what I have so far:
#!/bin/bash
#create the menu
echo -e "\n MENU\n"
echo " a. Current date and time"
echo " b. Users logged in"
echo " c. Name of working directory"
echo " d. Create file with a custom name"
echo -e " e. Exit the program \n"
read -p "Enter a, b, c, d, or e: " answer
echo
#read input and perform utility
case "$answer" in
a)
date
;;
b)
who
;;
c)
pwd
;;
d)
read -p "Enter a name for your file " file
touch "$file"
;;
e)
exit
;;
*)
echo "$answer is not an option"
;;
esac