-
Notifications
You must be signed in to change notification settings - Fork 0
/
misura.sh
37 lines (31 loc) · 976 Bytes
/
misura.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
#!/bin/bash
cd "output" ;
nclient=$(ls client* | wc -l) ;
for (( i=1; i<=$nclient; i++)); do
clientIDS[i]=$(cat client$i | grep SECRET | awk '{print $2}') ;
clientSCRT[i]=$(cat client$i | grep SECRET | awk '{print $4}');
done
( cat supervisor | grep BASED ) > temp.txt
exec 3<temp.txt
corrette=0;
errore=0;
while read -u3 line; do
stima=$(echo $line | awk '{print $3}') ;
id=$(echo $line | awk '{print $5}') ;
server=$(echo $line | awk '{print $7}') ;
for (( i=1; i<$nclient; i++ )); do
if [[ $id == ${clientIDS[i]} ]] ; then
d=$(($stima-${clientSCRT[i]}))
if [[ ($d -le 0 && $d -ge -25) ]]; then
corrette=$(($corrette+1))
errore=$(($errore-$d));
elif [[ ($d -ge 0 && $d -le 25) ]] ; then
corrette=$(($corrette+1))
errore=$(($errore+$d))
fi
fi
done
done
rm temp.txt
echo "STIME CORRETTE : $corrette $(echo "scale=2; $corrette/$nclient*100" | bc)% "
echo "ERRORE MEDIO COMMESSO : $(echo "scale=2; $errore/$nclient" | bc)"