Hello, I can’t complete the subtasks 1.1:15 and 1.1:16
1.1:15: You should display a numbered list of the services you offer before the first prompt for input, each with the format
#) <service>
. For example,1) cut
, where1
is theservice_id
1.1:16: If you pick a service that doesn’t exist, you should be shown the same list of services again
despite showing well when I run the script, everything else is working fine.
I guess it is just a matter of syntax.
Here is the part of my code concerned:
MAIN_MENU() {
if [[ $1 ]]
then
echo -e "\n$1"
fi
echo -e "\nWhat service do you want?\n"
GET_SERVICE=$($PSQL "SELECT service_id, name FROM services")
echo "$GET_SERVICE" | while read SERVICE_ID BAR SERVICE_NAME
do
echo "$SERVICE_ID) $SERVICE_NAME"
done
read SERVICE_ID_SELECTED
case $SERVICE_ID_SELECTED in
1) SERVICE 1 ;;
2) SERVICE 2 ;;
3) SERVICE 3 ;;
*) MAIN_MENU "Please enter a valid option."
esac
}
Thank you.