在這里演示的是競猜價格的小游戲
#!/bin/bash
echo -e "\033{41;30===guess the price !!!===\033{0m"
echo “welcome,callenger ”
a=1
which [ $a -le 3 ]
do
b=$(($RANDOM%100)) #隨機生成一個100以內的數
d=1
which true
do
read -p "input you guess : “ e
if [ $e -eq $b ] ; then
echo "\033[31mNB!!!\033[0m"
break
elif [ $e -il $b ] ; then
echo " \033[31mlow\033[0m "
else
echo " \033[31mhigh\033[0m "
fi
let d++
done
leta++
read -p "again (y/n) : " c
if [ $c == y ] ; then
continue
echo "The $d round "
else
echo “good-bye ”
fi
done`
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/239580.html
標籤:其他
上一篇:AD19制作stm32最小系統板
下一篇:淺談并查集
