#!/bin/bash
#A Little Game of Guess A Integer Between 0 ~ 99
#By kenthy#qingdaonews.com 2006-08-15
SNUM=`expr $RANDOM % 100`
echo "I just created an integer between 0~99 , and can you guess what it is ?"
GTIMES=0
while true
do
echo -n "Your Surmise: "
read GNUM
GTIMES=`expr $GTIMES + 1`
if [ $GNUM -eq $SNUM ] ; then
echo "Congratuations!!! You'v Got It!!!"
echo -e "The Number Is : $SNUM Your Guess Times Is : $GTIMES"
exit 0
elif [ $GNUM -gt $SNUM ] ; then
echo "Not The Right Result. Reduce It And Try It Again."
continue
else
echo "Not The Right Result. Increase it And Try It Again."
fi
done
阅读(1285) | 评论(0) | 转发(0) |