forked from mirigana/mirigana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
watch
executable file
·47 lines (35 loc) · 871 Bytes
/
watch
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
#!/usr/bin/env bash
BACKGROUND_FILES=(
"src/thirdparty/kuromoji.js"
"src/constants.js"
"src/background/rules/rule-fix.js"
"src/background/rules/rule-month.js"
"src/background/rules/rule-date.js"
"src/background/rules/rule-counter.js"
"src/background/rules/rule-purify.js"
"src/background/token-rules.js"
"src/background/memory-cache.js"
"src/background/background.js"
)
TARGET_FILE="src/background.js"
# trap ctrl-c and call ctrl_c()
trap ctrl_c INT
function ctrl_c() {
# echo "** Trapped CTRL-C"
exit 0
}
fwpid=0;
while true; do
rm $TARGET_FILE
for i in ${!BACKGROUND_FILES[@]}; do
cat ${BACKGROUND_FILES[$i]} >> $TARGET_FILE
done
echo $(date -u)
sleep 0.5
(
fswatch --event Updated -1 ${BACKGROUND_FILES[@]} && \
echo "above file has been changed."
)
# store the fswatch pid
fwpid=$!
done