$ cat add_array.ksh
#!/bin/ksh
set -A times 1 2 3 4 5 6
TIMESCOUNT=${#times[*]}
print "There are $TIMESCOUNT times elements"
print "times array = ${times[@]}"
TIMESIDX=0
SUM=0
while (( TIMESIDX < TIMESCOUNT ))
do
SUM=$(($SUM+${times[TIMESIDX]}))
TIMESIDX=$(($TIMESIDX+1))
done
print "SUM=$SUM"
exit 0
$ ./add_array.ksh
There are 6 times elements
times array = 1 2 3 4 5 6
SUM=21