-
Notifications
You must be signed in to change notification settings - Fork 0
/
DBMSscript.sh
executable file
·138 lines (121 loc) · 2.87 KB
/
DBMSscript.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/bash
export database_name
export table_name
database_name="test _datebase"
table_name="test _table"
use_database()
{
read -p "Enter the name of database to use : " database_name_user_input
input_database_name=$HOME"/database/"$database_name_user_input
if [ -d $input_database_name ]
then
database_name=$database_name_user_input
echo "SUCCESSFULLY : "$database_name" now used"
flag=true
break
else
echo "ERROR : databse not found . . 0 to return the previous menu"
if [ $database_name_user_input == 0 ]
then
flag=false
break
fi
fi
}
while true
do
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " M A I N - M E N U"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
read -p "Enter
1 create new database
2 use exists database
3 show databases
0 end the program
*-------------------------------------*
your choice : " user_choice_1
case $user_choice_1 in
1 )
./commands/create_database
;;
2 )
while true
do
use_database
done
#TODo here will be another manu
while $flag
do
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo " D A T A - M A N I P U L A T I O N"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
read -p "Enter
1 Create Table
2 Show Tables
3 Alter Table
4 Sort Table
5 Drop Table
6 Display Table
7 Add Record
8 Select Record[s]
9 Delete Record[s]
10 Edit Record[s]
0 return to main menu
*--------------------------------------*
your choice : " user_choice_2
case $user_choice_2 in
1 )
./commands/create_table
#echo "create_table"
;;
2 )
./commands/show_tables
#echo "show_tables"
;;
3 )
./commands/alter_table
#echo "alter_table"
;;
4 )
./commands/sort_table
#echo "sort_table"
;;
5 )
./commands/drop_table
#echo "drop_table"
;;
6 )
./commands/display_table
#echo "display_table"
;;
7 )
./commands/add_record
#echo "add_record"
;;
8 )
./commands/select_record
#echo "select_record"
;;
9 )
./commands/delete_record
#echo "delete_record"
;;
10 )
./commands/edit_record
#echo "edit_record"
;;
0 )
break
;;
esac
done
;;
3 )
./commands/show_databases
;;
0 )
echo "Thank you"
break
;;
esac
done