I am so lost !!!


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers I am so lost !!!
# 1  
Old 04-06-2008
I am so lost !!!

I am taking an online Linux class, which is mandatory for me to graduate. Unfortunately I got the worst online teacher ever, he never respond to any e-mails. I have no idea what going on in this class so I am turning to you guys.


Here is the questions for the week, Ok I don't expect anybody to just give me the answers. I want to learn the stuff so if you guys can just direct me to where I can find these answers and learn more basics cause we are using " A Practical guide to Linux by Mark G. Sobell" and I can't seem to make anything of it Smilie.
We are writing a midterm and a quiz this week and he didn't even tell us what material we have to cover. Waste of money if you ask me.

1. Here is a fragment from a shell script:

while who | grep robert >/dev/null

Which command's exit status (who or grep) will be used to determine if the while's condition is TRUE or FALSE?

________________


2. What type of loop will execute all the commands between do and done as long as the loop's condition is FALSE?

_____Until___________


3. What type of loop would be used if we wanted to execute a group of commands once for each item in a list?

____For____________


4. Complete the following code fragment so it runs the commands between do and done on all files in the current working directory that start with an upper-case letter and have .c as the last 2 characters.

for _________________________________________
do
echo $x
done


5. Complete the if statement in this code fragment so it will print "Yes" if the variable named temp is set y and "No" if it is not. (hint: use the "test" commend)

if ______________________________________________________
then
echo "Yes"
else
echo "No"
fi

6. Write a for loop to do the following: Assume we have a directory that has (amongst other things) the sections of a book we are writing stored in 10 files named section0, section1, ..., section9. We want to print to stdout each filename followed by the contents of the file for those (and only those) sections stored in section3 through section8 (inclusive). Write a for loop to do so.
















7. Write a shell script fragment that contains a while loop that checks every 5 seconds (or so) to see if the user robert is logged in. As long as robert is logged in, the script should print to stdout (screen) Bob's still logged in! Once robert logs out it should print to stdout Bob just logged out! Make sure to send any unwanted output to the null device (bit-bucket) so it doesn't show up on the screen.









8. Assume we have a script named p1 with the following contents:

echo $#
echo $2 $1
echo $*
ls /zzxxwqsaer 2>/dev/null >/dev/null # /zzxxwqsaer does not exist
echo $?

What is the exact output if we run the script with the command line p1 Bob Leslie Sarah?








9. Finish the shell script fragment so it gets input from the user and stores it in a variable called choice, then uses a case construct to run who | more if a or A is chosen, ps x if b or B is chosen, and w | more if c or C is chosen. DO NOT use a default case.

while :
do
echo "A - Who's logged on"
echo "B - List all my processes"
echo "C - List everyone's current process"
echo
echo "Enter choice:\c"










done

10. What is the purpose of the colon (Smilie after the while in the above script fragment?

It's a special condition that means "Always True"
# 2  
Old 04-06-2008
Please read the rules. No homework.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Lost my Way

I want to execute my own utilities from my bin folder without having to specify paths at run time - i.e. just enter name on command line - to do this my search path needs to be set up at login time - when I do this the path is not getting set right apparently(?) - PATH echos OK but the search... (0 Replies)
Discussion started by: robert stansel
0 Replies

2. UNIX for Dummies Questions & Answers

I am so lost...

I have been using linux now for about 6 months. I like it although it was quite a learning process. Pretty simple for the most part. Here is my prob... The first time I installed linux on my computer it went in just fine, no problems. It did eventually crash though and I had to re-install it.... (2 Replies)
Discussion started by: Treb
2 Replies

3. UNIX for Dummies Questions & Answers

I'm so lost...

Fair warning... I know nothing of Unix. That's why I joined this forum and I need your feedback desperatly. Here is the situation... I built an app using ASP and Northcode's SWF Studio v3 for a cd launcher tool for a client that develops software. They like the app and it works well on... (2 Replies)
Discussion started by: daJabberwocky
2 Replies

4. UNIX for Dummies Questions & Answers

ok im like lost and confused!!

:eek: im trying to make a website and im on a site that tells how... but, it says 2 access my unix account to make 1 online and im alrdy confused!! (1 Reply)
Discussion started by: blugsnorfia
1 Replies

5. Filesystems, Disks and Memory

Lost Data Lost Admin

First time so excuse my ignorance please. I may not be accurately describing the issue. I have inherited a small lab mostly SUN V120s. We lost power and are trying to recover. Nope no backups... The primary issue I have is 1 box is an Oracle Server. It has 2 36Gb harddrives. I am able to... (3 Replies)
Discussion started by: murphsr
3 Replies

6. UNIX for Dummies Questions & Answers

So lost

I have been reading up on starting a website, but i am still lost. I am in much need of assistance. Kind of a step by step because i still don't know where to start. please help. thank you (1 Reply)
Discussion started by: sweetie020602
1 Replies

7. Programming

Packets Getting Lost

I am working on a project, which has the following type of hardware setup. A special hardware device is receiving data from an external network interface. So we can have multiple such a hardware devices. Now these hardware devices will route the captured incoming data through the external... (4 Replies)
Discussion started by: S.P.Prasad
4 Replies

8. UNIX for Dummies Questions & Answers

Interested, but lost.

Alright, so I'm interested in using Unix, but I have a couple of pretty basic questions: 1) What's the relationship between Linux and Unix? Are they one and the same, or completely different? 2) Can you use Unix on a laptop? and 3) Where can you get Unix? Thanks for listening. (9 Replies)
Discussion started by: Ned
9 Replies

9. Shell Programming and Scripting

lost again

will this script work? I want to use it in unix. clear ans='y' While test $ans='y' do notfound() { echo $response " is not logged in" } found() { echo $response "is logged into " $name } name=`ps -eaf | grep "\<$response\>" | cut -b 80-85` if ; then name=`rsh server2 ps -eaf... (7 Replies)
Discussion started by: azman
7 Replies
Login or Register to Ask a Question