-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexe.sh
executable file
·65 lines (44 loc) · 885 Bytes
/
exe.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
61
62
63
64
65
#!/bin/bash
source ./src/src.sh
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
NC=$(tput sgr0)
recursive()
{
var=$1
test1=$(echo -n $var)
if [[ -d $var ]]; then
echo It is a directory. : $var
for var2 in "$var"/*
do
recursive $var2
echo dir
done
continue
elif [[ ! $var =~ ".json" ]]; then
echo "it is not json format"
continue
elif [[ $var =~ ".json" ]]; then
echo $var will be translated into other language version $var.
num=0
while [[ "$num" -le $LangNumber ]];
# $num is the number of countries to translate
do /usr/bin/expect <<- EOF
spawn node ./src/index.js $num $var
expect {file is written} {
sleep 0.3
send {echo ${GREEN}A language is finished.${NC}\r}
}
EOF
num=$((num + 1))
done
sleep 1
fi
}
for var1 in "$@"
do
echo target is $@
echo will execute function for $var1
recursive $var1
done
echo "Script done."