-
Notifications
You must be signed in to change notification settings - Fork 0
/
askno
executable file
·47 lines (43 loc) · 837 Bytes
/
askno
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
#!/bin/sh
q=""
start=0;
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
end=$(sqlite3 $DIR/major.db "select max(digits) from major;")
echo $end
if [ -z "$1" ]
then
echo start=$start
else
start=$1;
echo start=$start
fi
if [ -z "$2" ]
then
if [ "$1" != "" ]
then
end=$start
fi
echo end=$end
else
end=$2;
echo end=$end
fi
while [ "$q" != "exit" ]
do
digits=$(sqlite3 $DIR/major.db "select digits from major where digits <= '$end' and digits >='$start' order by random() limit 1;")
# echo $pao
pao=$(sqlite3 $DIR/major.db "select pao from major where digits='$digits'")
echo "Do you remember '$pao'?"
read q
if [ "$q" = "$digits" ]
then
echo "Right!"
else
while [ "$q" != "$digits" -a "$q" != "exit" ]
do
echo "Wrong!"
echo "It was '$digits'"
read q
done
fi
done