-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensorLifeTimeTest
More file actions
executable file
·82 lines (76 loc) · 1.46 KB
/
Copy pathsensorLifeTimeTest
File metadata and controls
executable file
·82 lines (76 loc) · 1.46 KB
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
#!/bin/sh
echo Sensor Life Time Test Record Tool. @2022 DUKECAT DESIGN.
if [ "$1" = "-c" ]
then
echo Create database!
sqlite3 irLifeTimeTest.db "create table testdata(obj, sn, value, date);"
echo Done.
exit 0
elif [ "$1" = "-l" ]
then
if [ -z $2 ]
then
sqlite3 irLifeTimeTest.db "select * from testdata;"
else
sqlite3 irLifeTimeTest.db "select * from testdata where obj = \"$2\";"
fi
exit 0
elif [ "$1" = "-d" ]
then
echo -n ARE YOU SURE?\(yEs\):
read AYS
if [ "$AYS" = "yEs" ]
then
rm irLifeTimeTest.db
fi
exit 0
elif [ "$1" = "-h" ]
then
echo This script is for DEVELOPMENT ONLY.
echo No Garantee for anything. sqlite3 is requirement.
echo $0 [option] [obj]
echo -c To Create database.
echo -d Delete database
echo -l Show all the data or obj data.
exit 0
elif [ -z $1 ]
then
echo Operate in Normal Mode.
else
echo $1 ??, -h for help!
exit 0
fi
if [ -f "irLifeTimeTest.db" ]
then
echo Database is exist.
else
echo Database is not exist, please create first.
exit 0
fi
echo -n Enter Object Name :
read OBJ
if [ -z $OBJ ]
then
echo Bye bye..
exit 0
fi
while :
do
echo -n Enter Series Number :
read SN
if [ -z $SN ]
then
echo Have a nice day..
exit 0
fi
testDate=`date "+%Y-%m-%d"`
echo -n Enter the Value :
read VALUE
if [ -z $VALUE ]
then
echo $SN have no value....
exit 0
fi
echo "OBJECT: $OBJ\tSN: $SN\tVALUE:$VALUE\tDATE:$testDate"
sqlite3 irLifeTimeTest.db "insert into testdata values(\"$OBJ\", $SN, $VALUE, \"$testDate\");"
done