Jak znaleźć sumę elementów w tablicy w skrypcie Bash
read -a array
tot=0
for i in ${array[@]}; do
let tot+=$i
done
echo "Total: $tot"
Armandres
read -a array
tot=0
for i in ${array[@]}; do
let tot+=$i
done
echo "Total: $tot"