面试题答案
一键面试#!/bin/bash
count_in_range() {
local start=$1
local end=$2
shift 2
local count=0
for num in "$@"; do
if (( num >= start && num <= end )); then
((count++))
fi
done
echo $count
}
read -p "请输入范围起始值、结束值及一组数字,以空格分隔: " nums
count=$(count_in_range $nums)
echo "在范围内的数字数量为: $count"