Skip to main content
2 of 2
oops. I mistakenly put in "local"; indent to be code
function median() { declare -a nums=($(cat)) printf '%s\n' "${nums[@]}" | sort -n | tail -n $((${#nums[@]} / 2 + 1)) | head -n 1 }