20 lines
410 B
Bash
20 lines
410 B
Bash
# Show the top "n" values of a set (first number is the "n" to get)
|
|
show_top() {
|
|
local n=$1
|
|
local values=${@:2:n}
|
|
echo "Top ${n} values: ${values}"
|
|
}
|
|
|
|
|
|
# This version uses shift to get the same result
|
|
show_top2 () {
|
|
# Grab the number of values to show, then shift.
|
|
local n=$1
|
|
shift
|
|
|
|
# Get the set of vaules to show
|
|
local values=${@:1:n}
|
|
echo "Top ${n} values: ${values}"
|
|
}
|
|
|