1.11M Members

shell script

 
0
 

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.

 
0
 

then???

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article