Search

Guess the number game in shell script

Execute the following script to play "Guess the number" Game on the linux terminal. The computer picks a random number between 0 and 10 and the user has to guess the same, with in 3 attempts.



Save the file as "guessTheNumber.sh" and execute the script from the terminal.

The output would look as shown below. You can increase the number of attempts by changing the value of the attempts variable .