how to sort array in decending order in shell script code example
Example: how to sort array in shell script
# sorts array arr and stores it in array arrSorted in ascending order
# %d for integers
# %f for floats
readarray -t arrSorted < <(printf '%d\n' "${arr[@]}" | sort)