-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.sh
executable file
·52 lines (48 loc) · 955 Bytes
/
script.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
#! /bin/bash
assign_degrees()
{
d1=$1
d2=$2
d3=$3
d4=$4
d=$5
}
change_data()
{
sed -i \
-e "s@^#define d1\t.*@#define d1\t$d1@" \
-e "s@^#define d2\t.*@#define d2\t$d2@" \
-e "s@^#define d3\t.*@#define d3\t$d3@" \
-e "s@^#define d4\t.*@#define d4\t$d4@" \
-e "s@^#define d\t.*@#define d\t$d@" data.h
}
while read LINE; do
echo $LINE | grep -q Special
if [ $? = 0 ]; then
LINE=$(echo $LINE | sed "s/Special: //")
LINE=$(echo $LINE | sed "s/ and d=/ /")
LINE=$(echo $LINE | sed "s/, 2.*//")
assign_degrees $LINE
REMAINDER=$(($d % $d1))
if [ ! $REMAINDER = 0 ]; then
REMAINDER=$(($d % $d2))
if [ $REMAINDER = 0 ]; then
TEMP=$d1
d1=$d2
d2=$TEMP
else
REMAINDER=$(($d % $d3))
if [ $REMAINDER = 0 ]; then
TEMP=$d1
d1=$d3
d3=$TEMP
fi
fi
fi
change_data
sleep 1
make make_list
sleep 1
./tester > outputs/"$d1-$d2-$d3-$d4-$d-p-3"
fi
done