Write a shell script, guess.sh that implements a simple number guessing game.
When run, the shell script prompts the user to guess a random number between 0
and 100.

If the user guesses incorrectly, the script prompts the user “Guess
higher” or “Guess lower” as appropriate and allows the user to guess again.

If the user guesses correctly, the script terminates printing out how many guesses the
user needed.
For example:

Guess my secret number (0­-100): 101
Thats not between 0 and 100
Guess my secret number (0­-100): 80
Guess higher
Guess my secret number (0­-100): 85Guess lower
Guess my secret number (0­1-00): 82
Right! You guessed my secret in 3 guesses.

Edited by Akshay nand

3 Years
Discussion Span
Last Post by cfajohnson
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.