Sponsored Content
Homework and Emergencies Homework & Coursework Questions Print questions from a questions folder in a sequential order Post 302475114 by moraks007 on Friday 26th of November 2010 12:47:03 PM
Old 11-26-2010
Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory.
2.) The folder should have a set-up,phase and display files

I have written a small script which i used to check for the existing users and their password.

What I need help with:
I have a set of questions in a file named questions,i want to be able to display questions one after the order,enter and answer and store my answer in a new file called results and be able to check if it is correct.I have questions 1 to 8.
question example:
9. How would you create a new directory called docs?
a) makedocs
b) mkdir docs
c) create docs
d) none of these

Enter answer
b
Enter question number, N for next question, P for previous question or Q for done

n


Thanks.

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 want to be able to print questions from a questions folder in a sequential order,
enter an answer ,store it and be able to validate a correct answer to a result file in PhaseTest folder


2. Relevant commands, code, scripts, algorithms:
Script order
1.)set up
2.)username
3.)question/answer
4.)calculate the output of the test



3. The attempts at a solution (include all code and scripts):

Code:
#!/bin/sh

echo Username
read i
echo Password
read j
Username=$i":"$j

valid=`grep -n $Username /$HOME/PhaseTest/userinfo | wc -l` 



if [ $valid -eq 1 ]
then
echo "********Welcome to Grounoch Marx University********"
date
#Display questions
cat questions
else
echo "Unauthorised user"
fi

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
De Montfort University,Leicester,Uk,lecturer Parminder,IMAT 5122

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by DukeNuke2; 11-26-2010 at 03:19 PM..
 

9 More Discussions You Might Find Interesting

1. Programming

C questions

What does "extern" do? ex. extern int x; and another question, what about using static in functions? like: static void foo(), why? (2 Replies)
Discussion started by: Esaia
2 Replies

2. UNIX for Dummies Questions & Answers

questions

Dear Guys , I have some Questions , i need to have answeres for . 1. now if i took a back up for /etc/passwd and /etc/shadow , like simple copy .. and Install a new system , and paste those two files to the new system ... are the passwords and user info. going to work ?? is it posibble ? ... (1 Reply)
Discussion started by: tamemi
1 Replies

3. UNIX for Dummies Questions & Answers

few questions

hi , i have got few questions 1) i created a file "-myfile" .how can i remove this?what command shud i issue 2) i used echo "TODAYS DATE" ; DATE..........but date is comoing in second line..how can i make it come in single line? 3) how can i list all files in a directory using for... (5 Replies)
Discussion started by: vivekshankar
5 Replies

4. AIX

Basic AIX Print Queue Questions

Morning, All I've been doing some work on AIX print queues, troubleshooting some underlying issues we've been having. In the process of this I've uncovered some potential gaps in our knowledge. Our typical setup is remote impact printers (In this case OKIML5520s, with NICs) and local queues... (0 Replies)
Discussion started by: alexop
0 Replies

5. Programming

Reading special characters while converting sequential file to line sequential

We have to convert a sequential file to a 80 char line sequential file (HP UX platform).The sequential file contains special characters. which after conversion of the file to line sequential are getting coverted into "new line" or "tab" and file is getting distorted. Is there any way to read these... (2 Replies)
Discussion started by: Rajeshsu
2 Replies

6. Programming

A few C questions

Hi guys. I'm writing a basic script in C# and there's a few areas where I am stuck, and I was wondering if you may be able to help me? 1) Can you embed an image into the source code so it will show in the windows GUI? 2) Can you change the background of the GUI? 3) How do you add an .ico to... (5 Replies)
Discussion started by: JayC89
5 Replies

7. Programming

C++ questions

1.) Let's say I have a list: apple1, apple2, apple3, apple4, apple5 Does anyone know how to display the txt file using c++? Does anyone know how to insert apple6 into the text file using link list and show the whole list including apple6? (1 Reply)
Discussion started by: bscot008
1 Replies

8. UNIX for Dummies Questions & Answers

Vi questions

Hello, I would like to know how we can highlight/select a section of a file in vi and delete that section if we don't want to use the dd command to delete one line at at time. There is one where we don't want to delete the whole line , but up to a certain word. (2 Replies)
Discussion started by: Pouchie1
2 Replies

9. Shell Programming and Scripting

awk to print missing and keep sequential ordering if not found

The below awk in bold will look for the ids in file1 in $2 of file2 and if they match print the line in file2. If an id is missing or not found in file2 (like BMPR2 in line4 of file1) I can not figure out how to add it to them to the lines in the output as missing in $3 following the same format.... (4 Replies)
Discussion started by: cmccabe
4 Replies
VCONSOLE.CONF(5)						   vconsole.conf						  VCONSOLE.CONF(5)

NAME
vconsole.conf - configuration file for the virtual console SYNOPSIS
/etc/vconsole.conf DESCRIPTION
The /etc/vconsole.conf file configures the virtual console, i.e. keyboard mapping and console font. The basic file format of the vconsole.conf is a newline-separated list environment-like shell-compatible variable assignments. It is possible to source the configuration from shell scripts, however, beyond mere variable assignments no shell features are supported, allowing applications to read the file without implementing a shell compatible execution engine. Note that the kernel command line options vconsole.keymap=, vconsole.keymap.toggle=, vconsole.font=, vconsole.font.map=, vconsole.font.unimap= may be used to override the console settings at boot. Depending on the operating system other configuration files might be checked for configuration of the virtual console as well, however only as fallback. OPTIONS
The following options are understood: KEYMAP=, KEYMAP_TOGGLE= Configures the key mapping table of for they keyboard. KEYMAP= defaults to us if not set. The KEYMAP_TOGGLE= can be used to configured a second toggle keymap and is by default unset. FONT=, FONT_MAP=, FONT_UNIMAP= Configures the console font, the console map and the unicode font map. FONT= defaults to latarcyrheb-sun16. EXAMPLE
Example 1. German keyboard and console /etc/vconsole.conf: KEYMAP=de-latin1 FONT=latarcyrheb-sun16 SEE ALSO
systemd(1), loadkeys(1), setfont(8), locale.conf(5) AUTHOR
Lennart Poettering <lennart@poettering.net> Developer systemd 10/07/2013 VCONSOLE.CONF(5)
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy