Hope everyone is having a nice day. I'm new to Bash and I was playing around with a code that I came up with. What it does it takes the data in a CSV file(A simple marks sheet) and add up all the marks for each module in the csv file. The code goes like this,
count=-1
sum=0
while read module mark
do
if(($count>-1))
then
echo "Mark is $mark"
sum=$(( $sum + $mark ))
fi
count=$((count+1))
done < $1
echo $sum
The CSV file is like this
Module,Mark
A,10
B,20
c,30
D,40
E,50
So I'm expecting to get the sum of the marks 150 but it gives me this error and stops executing.
Mark is 10
")syntax error: invalid arithmetic operator (error token is "
Can someone please help me out. Any help is much appreciated.