declare -i no ar=(1 1 1 1); br=(1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 2 0 0 0 0 0 0 0 1 1 0 3 0 0 0 0 0 0 1 1 0 0 4 4 5 0 0 0 1 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 ) echo "[][]|" echo " |" A="echo -en \\033[0;32m" B="echo -en \\033[1;31m" C="echo -en \\033[1;33m" D="echo -en \\033[0;39m" echo ----oldboy trainning----- && $A echo ----oldboy trainning----- && $B echo ----oldboy trainning----- && $C echo ----oldboy trainning----- && $D sshow() { for((i=0;i<80;i++)) do no=$i%10 [ $no -eq 0 ] && { echo " " && $C } case ${br[$i]} in 1 ) echo -e "${br[$i]} \c"&& $A ;; 2 )echo -e "${br[$i]} \c"&& $B ;; 3 )echo -e "${br[$i]} \c"&& $C ;; * )echo -e "${br[$i]} \c"&& $D ;; esac [ $i -eq 19 ] && { echo -e "then: \c" } [ $i -eq 59 ] && { echo -e "mark: \c" } done } sshow read ee function show() { for((i=0;i<80;i++)) do no=$i%10 [ $no -eq 0 ] && { echo " " } echo -e "${br[$i]} \c" [ $i -eq 19 ] && { echo -e "then: \c" } [ $i -eq 59 ] && { echo -e "mark: \c" } done } show function move() { for((i=1;i<3;i++)) { for(( j=1;j<5;j++)) { br[$i*10+j]=${ar[$j]} } show } } echo " " echo "##########################" move read ee echo ${ar[@]} echo ${br[@]} read ee for ((i=0;i<10;i++)) do read -n1 -t 1 -s -p "Enter your choose:" xx echo "your choose is $xx" echo "[][][][]" echo "[][]" echo "[][]" done
原文:http://wzsts.blog.51cto.com/10251779/1839680