i have been trying to do a small 'question and answer' script using if-else statement and a combination of pipe. I have succeeded in allowing the user to login with user name and password stored in a sequence username/password in a file named "pass" like this:
After a successful login, questions and options answers are displayed for the user to choose from example
3.) What is the capital of The United States of America?
a.) Texas
b) Florida
c) Washington D.C
d) Chicago
. The user after selecting the right one (like c in this case) should enter 'p' for previous, 'n' for next question and 'q' to quit the test and then see his result. My challenge is how to direct or redirect the user to any of these options.
I am currently working on a timer for the script using the 'sleep' command.
Please i would be very grateful if someone can help me.
Thanks.
Last edited by Scott; 11-01-2010 at 05:13 PM..
Reason: Please use code tags
Hi all
I have tried to search for this, but keep getting a MySQL db connect error, so am posing the question here, and taking a risk of incurring the wrath of the mods with my first post...
I have the following test script:
#!/bin/bash
HTTPD=`/bin/ps -axcu | /usr/bin/grep httpd... (6 Replies)
Hi Guys,
could someone tell me what this ksh construct does
typeset -r PROG_PWD=${0%/*} does
I understand the -r for readonly but I would very much appreciate a definitive account of what this will set $PROG_PWD to.
If I run this at the cmd line it it gets set to /usr/bin but I would... (2 Replies)
Hi all,
Sorry to ask this easy question but I am stuck. In a scenario i am executing one shell script which contains a if - else construct :
if ; then
echo $line
$line >> successful_build.txt
else
$line >> failed_services.txt
fi
explaination : if the... (5 Replies)
I'd like to create a variable with the value of X number of space( no Perl please), printf seems to work, but , in following example,10 spaces becomes 1 space when assinged to a variable, Why? other solutions are welcome.
$printf "=%10s=\n"
= =
$var=$(printf "=%10s=\n")
echo... (4 Replies)
Please help me out: I've seen this construct
awk '{...}1'several times, like in scrutinizer's today's post
awk '{for(i=2;i<=NF;i++)if($i==$1)$i=RS $i}1' infilebut I can't find (manuals, man pages, internet FAQs,...) an explanation of what it does resp. stands for. Any hint is appreciated! (5 Replies)
Hi,
I need to construct the below path from the two available directory path,
O/P
/home/data/test/run/ht/WEB/HTML
/home/data/test/run/ht/WEB/JSP
/home/data/test/run/ht/WEB/CSS
Path:1
------
/home/data/test/run/
Path:2
------
/home/data/share/app/01/lang/ht/WEB/HTML... (5 Replies)
Hi everybody!!
Here is the thing; I have a trouble in this simple situation, I'm trying to write an array with all the arguments of a command. I mean, if I have:
./mycommand.sh aa bb cc dd
I need to take an array like this:
myarray=(aa bb cc dd)
So I use a simple for loop like this:
for... (4 Replies)
Hi,
I don't understand && and || in this context. I thought && is for logical 'AND' and || is for logical 'OR'.
&& echo "Not empty" || echo "Empty"
Please help
Thank You (5 Replies)
Hi all,
I thought this would be simple, but I've been having a lot of trouble trying to write this IF statement, if I may ask for help pls:
In BASH, how would I construct the if statement:
Should ONLY be true if USEROPTscript=="yes"]] AND $mode=="INSTALL" /or/ $mode=="CHANGE" ]]... (3 Replies)