标签:linux游戏
linux编写猜数字游戏:
#!/bin/bash n=1 while [ $n -le 3 ] do a=`expr $RANDOM % 10` b=0 echo "cai jia ge di $n lun " while [ $b -le 4 ] do read -p "shu ru jia ge : " c let b++ if [ $c -eq $a ] then echo "cai dui le" echo "cai le $b ci" break elif [ $c -lt $a ] then echo "di le" else echo "gao le" fi done if [ $b -eq 5 ] then echo " chao guo wu ci shi bai tui chu " exit 0 fi read -p "shi fou ji xu: " m if [ $m = y ] then let n++ echo " ji xu you xi " else n=` expr $n + 10 ` echo " tui chu you xi " fi done
本文出自 “杨阳” 博客,请务必保留此出处http://yangyy.blog.51cto.com/12354524/1878709
标签:linux游戏
原文地址:http://yangyy.blog.51cto.com/12354524/1878709