-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdropDatabase.sh
More file actions
executable file
·44 lines (38 loc) · 1.08 KB
/
Copy pathdropDatabase.sh
File metadata and controls
executable file
·44 lines (38 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
printf "\n"
echo -e "${BBlue}###################"
echo -e "## DROP DATABASE ##"
echo -e "###################"
printf "\n"
echo -e " Choose DataBase to Drop${Color_Off}"
databasesDir=($(find ./DataBases -mindepth 1 -type d | cut -d/ -f3))
if ((${#databasesDir[@]}==0))
then
echo "no Databases, you will be redirected to main menu in 2 seconds"
sleep 2
source ./divide.sh
source ./mainMenu.sh
else
select choice in ${databasesDir[@]} "back to Main Menu"
do
if ! [[ $REPLY =~ ^[1-9]+0*$ ]]
then
echo -e "${Red}enter a valid Number${Color_Off}"
continue
fi
if (($REPLY>${#databasesDir[@]}+1))
then
echo -e "${Red}enter a valid number${Color_Off}"
continue
fi
if (($REPLY==${#databasesDir[@]}+1))
then
source ./mainMenu.sh
break
fi
rm -r DataBases/$choice
echo -e "${Green}The database with the name $choice was Dropped${Color_Off}"
source ./divide.sh
source ./mainMenu.sh
done
fi