Sum Array

Calculate the sum of all numbers in an array.

Code

General
echo "$arr" | tr -d '[]' | tr ',' '\n' | awk '{s+=$1} END {print s}'

Parameters

JSON array of numbers

Server

More Bash Snippets