Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google site



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 !!

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread 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"
Sponsored Links
  #2 (permalink)  
Old 04-06-2008
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,150
Please read the rules. No homework.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


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 05:13 PM
I am so lost... Treb UNIX for Dummies Questions & Answers 2 10-18-2007 04:03 AM
I'm so lost... daJabberwocky UNIX for Dummies Questions & Answers 2 09-21-2006 11:17 AM
Lost Data Lost Admin murphsr Filesystems, Disks and Memory 3 09-07-2005 03:35 PM
So lost sweetie020602 UNIX for Dummies Questions & Answers 1 08-17-2005 10:52 PM



All times are GMT -4. The time now is 08:53 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0