Give user 5 chances to guess my favorite color


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Give user 5 chances to guess my favorite color
# 1  
Old 08-01-2011
Give user 5 chances to guess my favorite color

I wrote a script to give a user 5 guesses on what is my favorite color but I it doesn't work. I've only been scripting for a couple weeks and need some help it seems simple but how do I give the user 5 guesses?
# 2  
Old 08-01-2011
Please post what you have done so far.
# 3  
Old 08-01-2011
Code:
guess=1
while [ "${guess}" -le 5 ]; do
...
increment guess
done

with bash:

Code:
for ((guess=1; guess <= 5; guess++)); do
...
done


Last edited by neutronscott; 08-01-2011 at 07:43 PM.. Reason: code tag, derrrr
# 4  
Old 08-01-2011
From a guy's point of view there is only a maximum of six answers, and you are giving the user 5 chances to guess it ??
  • Red
  • Blue
  • Green
  • Orange
  • Purple
  • Yellow

* White and Black don't count, they are hues, not colors.

This is satiric for those that don't get it. Besides, this is obvious homework.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Bash Script for Dice Game; Issue with if...else loop to verify user guess is within range

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have written a script for a dice game that: (1) tells user that each of the 2 die are 6 sided (Spots=6); (2)... (3 Replies)
Discussion started by: LaurenRose
3 Replies

2. Shell Programming and Scripting

Script to give a user sudo permissions

Can some one please let me know a script which gives the user sudo permissions? Thanks in advance.... (6 Replies)
Discussion started by: Revanth547
6 Replies

3. Shell Programming and Scripting

How to give color and space?

I have write one scripts,i want give the color for only one line and give the space for 2line. how to give the color and space of line.... (7 Replies)
Discussion started by: rajivgandhi
7 Replies

4. Shell Programming and Scripting

give some color to a word on echo output

Hi Supposed this text output: How can I show $HOSTNAME in other color than blank? :-) KSH on AIX (4 Replies)
Discussion started by: iga3725
4 Replies

5. UNIX for Advanced & Expert Users

how can i use /usr/ucb/ps to give the full user

Hi, on solaris I need the full ps output, and process this. With /usr/ucb/ps auxwww I get the output as wanted, but the user is cut off to 8 long. With ps -o ruser I can get the full username, but I do not have the full output. Is it possible to get long output, with the full username? ... (1 Reply)
Discussion started by: dimpie
1 Replies

6. UNIX for Dummies Questions & Answers

How to give an ordinary user the superuser (root) ID which is 0

How to give an ordinary user the superuser (root) ID which is 0 (9 Replies)
Discussion started by: sharaola
9 Replies

7. AIX

[Help] Give privilege to an ordinary user

I'm trying to give a non-root user the right to start IBM HTTP Server, the web server is listening on port 80, but for AIX, ports under 1024 are privilege ports which can be used only by root. /usr/IBMIHS/bin# ./apachectl start (13)Permission denied: make_sock: could not bind to address :::80... (1 Reply)
Discussion started by: ibmer414
1 Replies

8. UNIX for Dummies Questions & Answers

How to give permission for a specified user

Hi All, How can i give permission for a specific user ( eg. admin ) ? I tried with chmod admin+r prog.sh which doesnt work. Is there any way i can specify a user's name and give the permission? Thanks in advance. Saneesh Joseph. (1 Reply)
Discussion started by: saneeshjose
1 Replies
Login or Register to Ask a Question