The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Lost my Way robert stansel UNIX for Dummies Questions & Answers 0 01-31-2008 01:13 PM
I am so lost... Treb UNIX for Dummies Questions & Answers 2 10-18-2007 12:03 AM
I'm so lost... daJabberwocky UNIX for Dummies Questions & Answers 2 09-21-2006 07:17 AM
Lost Data Lost Admin murphsr Filesystems, Disks and Memory 3 09-07-2005 11:35 AM
So lost sweetie020602 UNIX for Dummies Questions & Answers 1 08-17-2005 06:52 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2008
Registered User
 

Join Date: Mar 2008
Posts: 1
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 .
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 ( after the while in the above script fragment?

It's a special condition that means "Always True"
Forum Sponsor
  #2 (permalink)  
Old 04-06-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,352
Please read the rules. No homework.
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0