Aggregate

array_sum

Sum all numeric elements in a named array.

Example

nums=( 1 2 3 4 5 )
array_sum nums  # => 15

Arguments

  • $1 (string): Name of the array variable.

Exit codes

  • 0: Always

Output on stdout

  • The sum of all elements.

array_min

Print the minimum numeric value in a named array.

Example

nums=( 3 1 4 1 5 9 )
array_min nums  # => 1

Arguments

  • $1 (string): Name of the array variable.

Exit codes

  • 0: Always

Output on stdout

  • The minimum element value.

array_max

Print the maximum numeric value in a named array.

Example

nums=( 3 1 4 1 5 9 )
array_max nums  # => 9

Arguments

  • $1 (string): Name of the array variable.

Exit codes

  • 0: Always

Output on stdout

  • The maximum element value.

array_product

Multiply all numeric elements in a named array.

Example

nums=( 2 3 4 )
array_product nums  # => 24

Arguments

  • $1 (string): Name of the array variable.

Exit codes

  • 0: Always

Output on stdout

  • The product of all elements.