1,105,386 Community Members

shell script

Member Avatar
Akshay nand
Newbie Poster
4 posts since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
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.

Member Avatar
armie340
Newbie Poster
10 posts since Mar 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

then???

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