-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelete_Database.sh
executable file
·51 lines (41 loc) · 1.39 KB
/
delete_Database.sh
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
45
46
47
48
49
50
#!/bin/bash
LC_ALL=C
shopt -s extglob
source "functions"
clear
# source $(pwd)/"functions"
echo "Enter Database Name you want delete : "
read database_name
#validate if name of database is true ..
case $database_name in
#validate that the name must have not white spaces..
*\ *)
echo "-----------------------------------------------------------------------"
echo "Invalid database name!! the name must be without no spaces..!! "
;;
#validate that the name must be letters only..
+([[:digit:]]))
echo "-----------------------------------------------------------------------"
echo "Invalid database name!! the name must be letters and do not have whitespaces!!!!!"
;;
#the valid regix for name..
+([a-zA-Z]))
#check if tha database exist...
check_database_exist "$database_name"
if [ $? -eq 1 ]; then
#delete database1.
rm -R $database_name
echo "Database deleted "
echo "---------------------------------------------------"
else
echo "---------------------------------------------------"
echo "No database with this name "
fi
;;
*)
echo "-----------------------------------------------------"
echo "Invalid database name!! name of database must be lower or upper letters or mix and do not have whitespaces!!!! "
;;
esac
source $(pwd)/DatabaseEngine.sh
source $(pwd)/DatabaseEngine.sh