Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

sum of array elements bash

read -a array
tot=0
for i in ${array[@]}; do
  let tot+=$i
done
echo "Total: $tot"
 
PREVIOUS NEXT
Tagged: #sum #array #elements #bash
ADD COMMENT
Topic
Name
7+7 =