I need help with a loop game in script
I need to make a game for my linux class and im so lost on how to do this.
I have to make a game and here is what i was told to do: Display: Do you want to do even or odd numbers? Enter 1 for odd or 2 for even. Ask the user which number will come next? Show the option they entered and then the correct number. Tell the child if they got it correct. (display the “correct” in green if the child got it right and “wrong” with the correct answer in red if they got it wrong) Keep asking until you get to 20. If someone can help me with this i would greatly appreciate it |
Hi,
there are literally thousands of examples on how to write this type of script available online. You favourite search engine will help you find them. If you have trouble, post what you have done, explain the problem and we will try to guide you in the right direction. We will not however do your homework for you. Evo2. |
Not asking for anyone to do my homework for me Im asking if anyone has an example I looked up on google and didnt find anything that remotely helped me.
|
Hi,
I guess your search terms were off. Here is the first hit that google returned when I searched for "bash script example read input from user" http://tldp.org/LDP/Bash-Beginners-G...ect_08_02.html Then you'll need to learn about for (or while) loops simple integer math, if statements and escape sequences to change the output colour. Evo2. |
Thanks :)
|
You can implement all of this using bash, below is an example. If you don't take the time to actually learn this you will be cheating yourself out of an education.
Code:
#!/bin/bash |
All times are GMT -5. The time now is 06:58 AM. |