-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelete_table.sh
executable file
·60 lines (50 loc) · 1005 Bytes
/
delete_table.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
#!/usr/bin/bash
#this script needs to be called with argument 1 the DB name
tmpForm=$(yad \
--center \
--title "7amasa DB Engine" \
--form --field="Enter Table Name" \
--button=gtk-ok:0 \
--button=gtk-cancel:1 \
)
choice0=$?
if [ $choice0 = 1 ]
then
continue
elif [ $choice0 = 252 ]
then
kill -9 `ps --pid $$ -oppid=`; exit
elif [ $choice0 = 0 ]
then
tName=$(echo $tmpForm | awk 'BEGIN {FS="|" } { print $1 }')
if [ -f /var/7amasaDB/$1/$tName -a $tName ]
then
tmpForm=$(yad \
--center \
--title "7amasa DB Engine" \
--text "Are you sure that you want to delete table $tName ?" \
--button="yes":1 \
--button="NO":2 \
)
choice=$?
case $choice in
1) rm -f /var/7amasaDB/$1/$tName
sed -i "/$tName/d" /var/7amasaDB/$1/.meta
break
;;
2)
break
;;
252)
kill -9 `ps --pid $$ -oppid=`; exit
;;
esac
else
tmpForm=$(yad \
--center \
--title "7amasa DB Engine" \
--text "$tName Table not found" \
--button=gtk-go-back:1 \
)
fi
fi