#!/bin/bash
read -p "请输入你的选择(石头 剪刀 布):" b0
a0=$[RANDOM % 3 + 1]
#1为石头 2为剪刀 3为布
if [ $a0 -eq 1 ];then
if [ $b0 == 石头 ];then &>/dev/null
echo "平局"
elif [ $b0 == 剪刀 ];then &>/dev/null
echo "你输了=="
elif [ $b0 == 布 ];then &>/dev/null
echo "恭喜你,你赢了!"
else
echo "请输入正确的选择"
fi
elif [ $a0 -eq 2 ];then
if [ $b0 == 石头 ];then &>/dev/null
echo "恭喜你,你赢了!"
elif [ $b0 == 剪刀 ];then &>/dev/null
echo "平局"
elif [ $b0 == 布 ];then &>/dev/null
echo "你输了=
="
else
echo "请输入正确的选择"
fi
else
if [ $b0 == 石头 ];then &>/dev/null
echo "你输了=_="
elif [ $b0 == 剪刀 ];then &>/dev/null
echo "恭喜你,你赢了!"
elif [ $b0 == 布 ]; then &>/dev/null
echo "平局"
else
echo "请输入正确的选择"
fi
fi
~