I was wondering if there is some syntax or some method to perform an operation 
(the same operation) on all elements of an array.

for example:

x=( 1 2 3 4 5 6 7 8 9 10 )

is there a shortcut to this:
((x[0]+x[1]+x[2]+x[3] ... )) as well as avoiding a for loop?

I had imagined something like x[@]+

Of course, if not, i’ve always got the classic:
for i in ${x[@]}
do
    (( total=total+i ))
done
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to