#!/bin/bash
num=`echo $random$random |cut -c 2-3`
date=`date +%y%m%d-%h:%m`
read -p please input your name: user
i=1
while true
do
read -p please input a double-digit: input
case $input in
[0-9][0-9] )
if [ $input -gt $num ] ;then
echo try smaller!
elif [ $input -lt $num ];then
echo try bigger!
else
echo good! you are right!
break;
fi ;;
*)
echo the number should be in 1 to 100: ;;
esac
i=$((i+1))
done
printf %-12s %s\n your record is $i! try better next time! $date |tee -a ./record.record
printf \n\n
printf %15s %6s %-8s\n ----- history record -----
cat ./record.record |sort -k5 -g|awk -f! '{print $1,!,$3}'|head -10
printf %15s %6s %-8s\n ----- history record -----