From: Pranav_ on
declare -a timevect
timelist=`cat "$LOGFILE"`
timevect=($timelist)

sumt=0
for cnt in ${timevect[@]:0}
do
sumt=$(echo "scale=12; $sumt+$cnt" | bc)
done

while calculating the sum of all integers in the LOGFILE I am getting
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error
(standard_in) 1: parse error

I am not getting why I am getting this error exactly, Some times it
works fine, but many times I get above mentioned error. Can anyone
please help me?
From: Janis Papanagnou on
Pranav_ schrieb:
> declare -a timevect
> timelist=`cat "$LOGFILE"`
> timevect=($timelist)
>
> sumt=0
> for cnt in ${timevect[@]:0}
> do
> sumt=$(echo "scale=12; $sumt+$cnt" | bc)
> done
>
> while calculating the sum of all integers in the LOGFILE I am getting
> (standard_in) 1: parse error
> (standard_in) 1: parse error
> (standard_in) 1: parse error
> (standard_in) 1: parse error
> (standard_in) 1: parse error
>
> I am not getting why I am getting this error exactly, Some times it
> works fine, but many times I get above mentioned error. Can anyone
> please help me?

Add set -x as the first command in your script and see what is
displayed.

Janis