-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnectdb.sh
executable file
·38 lines (38 loc) · 1.01 KB
/
connectdb.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
#!/usr/bin/bash
connect_db(){
read -p "enter your database name :" -r connect_dbname
if [ -d $connect_dbname ];
then
cd $connect_dbname
PS3=$(echo -e "current database : $(pwd|cut -d '/' -f 5)\nPlease enter your choice": )
select option in 'Create table' 'List tables' "Insert into table" "Delete table" "select from table" "delete from table" "update tables" "back to menu" "exit"
do
case $option in
"Create table") . ../createtable.sh
;;
"List tables") . ../tableslist.sh
;;
"Insert into table") . ../insert.sh
;;
"Delete table") . ../deletetable.sh
;;
"select from table") . ../select.sh
;;
"update tables") . ../update.sh
;;
"delete from table") . ../dropfromtable.sh
;;
"back to menu") cd .. ; menu
;;
"exit") exit
;;
*) echo "error"
;;
esac
done
else
echo "database don't exist "
menu
fi
}
connect_db