Answers for "shell script array elements in addition"

0

sum of array elements bash

read -a array
tot=0
for i in ${array[@]}; do
  let tot+=$i
done
echo "Total: $tot"
Posted by: Guest on November-26-2020

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language