Scav
Mostly Harmless
- Joined
- May 8, 2010
- Messages
- 1,002
- Reaction score
- 38
- Points
- 48
Here's a rotten example of my playing around with BASH scripting . . .
And no. I'm not ready to tackle C# programming yet. :lol:
Code:
#~/bin/multiguess
#
clear
echo "I am thinking of a number between 0 and 32,767. You have four guesses to get it right."
read pause
echo "Just kidding! I wouldn't really do THAT to you . . . but I DO have an easier one: From 0-9."
echo "Are you ready? Here we go!"
echo "(Press any key to continue.)"
read pause
correct=no
while [ $correct="no" ]; do
clear
echo "Please enter a number between 0 and 9."
read number
let counter=counter+1
if [ $number -eq 7 ]; then
echo "Correct! You've guessed it! And it only took you" $counter " attempt(s) to guess it!"
correct=yes
else
echo "Nope . . . sorry. Try again!"
fi
echo "(Press any key to continue.)"
read pause
done
#Code counter cleanup.
if [ $counter -gt 1 ]; then
let counter=0
fi