#!/bin/bash
a=$((RANDOM%100))
b=0
echo $a
while :
do
let b++
read -ep "输入一个数" shu
if [ $a -eq $shu ]; then
echo "相等"
break
elif [ $a -gt $shu ]; then
echo "小了"
else
echo "大了"
fi
done
echo "实验的次数$b"
#!/bin/bash
a=$((RANDOM%100))
b=0
echo $a
while :
do
let b++
read -ep "输入一个数" shu
if [ $a -eq $shu ]; then
echo "相等"
break
elif [ $a -gt $shu ]; then
echo "小了"
else
echo "大了"
fi
done
echo "实验的次数$b"