from reading the man page of bc, it seems that bc can accept simple variables, but also arrays as input.
However, if I try to add two arrays, I only get a single element as an output
a=(1 2 3)
b=(10 11 12)
c=`echo "$a + $b" | bc`
Then c only contains 11. If there a way to get bc to operate on all elements in the arrays to produce (11 13 15) as an output? Or do I need to do a loop?
ca single string. Note that"$a"whenais an array refers implictly to"${a[0]}".echo "$a + $b"is generating a single string; bc can't see the original variables and has no way of knowing what their values were.