bash code to sum all the numeric elements of an array code example
Example: sum of array elements bash
read -a array
tot=0
for i in ${array[@]}; do
let tot+=$i
done
echo "Total: $tot"
read -a array
tot=0
for i in ${array[@]}; do
let tot+=$i
done
echo "Total: $tot"