-
Notifications
You must be signed in to change notification settings - Fork 0
/
sf_init.sh
executable file
·55 lines (55 loc) · 903 Bytes
/
sf_init.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
#! /bin/sh
trap "exit 1" INT TERM
#
# spam filter programs by [email protected]
#
#----------------------------------------------------------------------
#
# functions
#
function show_help () {
echo "Usage : $0"
echo "Initialize database."
}
#----------------------------------------------------------------------
#
# main routin
#
if [ "X$1" = "X-h" -o "X$1" = "X--help" ]
then
show_help
exit 0
fi
#
if [ "X${SFDIR}" = "X" ]
then
SFDIR=${HOME}/.sf
fi
#
if [ "X${SFDB}" = "X" ]
then
SFDB=sf.db
fi
#
SFDB_PATH=${SFDIR}/${SFDB}
#
rm -f ${SFDB_PATH}
#
sqlite3 ${SFDB_PATH} <<__EOF__
create table t_white (
term text primary key,
count integer
);
create table t_black (
term text primary key,
count integer
);
create table t_total (
tablenm text primary key,
count integer
);
insert into t_total values("t_white",0);
insert into t_total values("t_black",0);
__EOF__
#
exit 0