vim shuzi·sh
#!/bin/bash
a=$(expr ${RANDOM} % 1000)
echo "zhe ge shu zi zai (0-999) zhi jian"
while true
do
let count++
read -p "qing shu ru cai de shu zi: "b
if [ $b -eq $a ]
then
echo "ok$b"
echo "yi gong cai le $(count)ci! "
exit 0
elif [ $b -gt $a ]
then
echo "gao le! "
else
echo "di le! "
fi
done

·/shuzi·sh