#!/bin/bash
a=$(expr $RANDOM % ) #生成一到一百的随机数
echo $a #打印随机数
b=
while true
do
let b++
echo "比较了第$b次!"
read -p "请输入一个1-100的随机数数: " num
if [ $num -gt ]; then
echo "输入错误!请重新输入!"
continue
elif [ $num -le ]; then
if [ $num -lt $a ]; then
echo "sorry,小了"
elif [ $num -gt $a ]; then
echo "sorry,大了"
elif [ $num -eq $a ]; then
echo "恭喜,俩个数相等,获得大奖"
break
fi
fi
done
05-28 23:25