I’ve got some issues on scripting… if someone could help me, it would be really good !
My script has:
VISITS=$((WR + RD));
SERVICE_DEMAND=$((VISITS*SERVICE_DEMAND));
And I’m getting this error:
./calc_serv_demand.sh: line 12:
0.0895406: syntax error: invalid arithmetic operator (error token is
“.0895406”)
Can someone help me?
I think it’s because the bash works only with integer… I need to use float values, though.
thanks in advance
Problem solved:
VISITS=$(echo $WR + $RD | bc);
echo $VISITS
SERVICE_DEMAND=$(echo $VISITS ‘*’ $SERVICE_TIME | bc);
echo $SERVICE_DEMAND
You can use
bcto do your floating point calculations, i.e.and so on.