标签:tween sse NPU sed pre 游戏 -bash 随机数 count
重点:如何生成随机数?
#!/bin/bash
#
random=$(date +%s%N)
max=100
number=$((random%max))
guess=0
guessCount=0
echo "Guess a guess between 1 and $max."
while [ "$guess" -ne $number ]; do
/bin/echo -n "Guess a guess? ";
read guess
if [ "$guess" -gt $number ]; then
echo "too big! input a smaller one: "
elif [ "$guess" -lt $number ]; then
echo "too small! input bigger one: "
fi
guessCount=$(($guessCount+1))
done
echo "Bingo!!! Guessed $number in $guessCount guesses."
exit 0
标签:tween sse NPU sed pre 游戏 -bash 随机数 count
原文地址:https://www.cnblogs.com/bigtree2pingping/p/13047315.html