Multiply array elements
<p>So I'm learning bash and need to do a simple script to multiply array elements by calling a function.</p>

<p>My code so far is this, but it ain't working at all. I believe there is a much simpler way than this (incrementing the <code>pos</code> variable so as to move to the next array element feels simply wrong).</p>

<pre><code>array=(1 2 3 4 5 100)
sum=0
pos=1


function multiplicate {
        for i in ${array[*]};do
                sum=$(($i * $array[pos]))
                let pos++ 
        done
}

multiplicate

echo $sum
</code></pre>

<p>I did my best to google the solution but was unable to find any relevant information, I found how to sum by using bc, but it simply wouldn't work by replacing <code>+</code> with <code>*</code>.</p>