Random number generating script?

Having a hard time with this. Very new to scripting and linux. Spent all sunday trying to do this. Appreciate some help and maybe help breaking down what the syntax does.

Create a Bash program. It should have the following properties

� Creates a secret number between 1 and 100
i. The program should automatically assign a different number each time you run the script
� Asks the user to provide a guess for the secret number

i. The program should keep asking until the user guesses the number correctly
� If the guessed number is higher than the secret number, print �Lower� to the screen
� If the guessed number is lower than the secret number, print �Higher�
� If the guessed number matches the secret number, print �Correct�, and end the program

output looks like,

What is your guess?
99
Higher!
What is your guess?
100
Correct
ubuntu$ ./script.sh 
What is your guess?
50
Lower

Is this a homework assignment?

What have you tried?

Where are you stuck?

yeah it is. I'm having trouble with the whole thing.

#!/bin/bash

num=$(( RANDOM % 100 + 1 ))

echo "guess a number? "
read

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

Please review the guidelines for posting homework and repost.

This thread is closed.