added clear and exit as valid input

This commit is contained in:
Shihaam Abdul Rahman 2021-04-30 22:33:07 +05:00
parent 1bddfec181
commit 1257f37b55
2 changed files with 34 additions and 21 deletions

View File

@ -3,32 +3,40 @@ echo "Contacts"
echo ""
echo "1 - List Contacts"
echo "2 - Add Contact"
echo "3 - Delete Conact"
echo "3 - Delete Contact"
echo "4 - Go back"
echo "5 - Exit"
echo ""
printf 'Please Input: '
read -r CONTATCS
read -r CONTACTS
if [ "$CONTATCS" = "1" ]
then
if [ "$CONTACTS" = "1" ]
then
source listcontacts.sh
elif [ "$CONTATCS" = "2" ]
then
elif [ "$CONTACTS" = "2" ]
then
source addcontact-menu.sh
elif [ "$CONTATCS" = "3" ]
then
elif [ "$CONTACTS" = "3" ]
then
source deletecontact.sh
elif [ "$CONTATCS" = "4" ]
then
elif [ "$CONTACTS" = "4" ]
then
source mainmenu.sh
elif [ "$CONTATCS" = "5" ]
then
rm $COOKIE
elif [ "$CONTACTS" = "back" ]
then
sleep 0.2
source mainmenu.sh
elif [ "$CONTACTS" = "clear" ]
then
sleep 0.2
clear
source contactsmenu.sh
elif [ "$CONTACTS" = "exit" ]
then
echo "Cleaning up.."
rm $COOKIE
sleep 0.2
exit
else
echo "${red}There was an error${reset}" 1>&2
echo ${red}Invalid input:${yellow} $CONTACTS ${reset} 1>&2
source contactsmenu.sh
fi

View File

@ -6,7 +6,6 @@ echo "3 - Contacts"
echo "4 - Activities"
echo "5 - Services"
echo "6 - Settings"
echo "7 - Exit"
echo ""
printf 'Please Input: '
read -r MENU
@ -44,12 +43,18 @@ elif [ "$MENU" = "6" ]
sleep 2
source mainmenu.sh
source settingsmenu.sh
elif [ "$MENU" = "7" ]
elif [ "$MENU" = "clear" ]
then
clear
sleep 0.2
source mainmenu.sh
elif [ "$MENU" = "exit" ]
then
echo "cleaning up..."
rm $COOKIE
sleep 0.2
exit
else
echo "${red}There was an error${reset}" 1>&2
source mainmenu.sh
echo ${red}Invalid input:${yellow} $MENU ${reset} 1>&2
source mainmenu.sh
fi