I'm currently working for a little game card project with c++ but I need some stats, here I would like to make an average of the number of round before a victory. I try bash to do it but I have a little error and I'm pretty new to bash.
here is the code :
#!/bin/bash
i="1"
moyenne="1"
while [ $i -le 40 ]
do
moyenne = $(($moyenne + ./a.out 2>&1 | tail -1))
((i++))
done
and there is my error
./script.sh: line 7: 1 + ./a.out 2>&1 | tail -1: syntax error: operand expected (error token is "./a.out 2>&1 | tail -1")