BCS 215 Final Exam

In your home (login) directory, create a subdirectory named "shared".
Set permissions allowing new files to be created by anyone in the group "/home/students/" BUT not allowing directory to be searched.
Users outside the group can access a file if (and only if) they know the file name.

Everything below should be in your ~/final/ directory ("~/final/"), along with your projects three, four, five.

Execute unix commands to write the following to a file named six, in your ~/final/ dir.
  1. Your First and Last name.
  2. Today's date and time.
  3. What day of the year (from 1 to 365) is today?
  4. How many user names (in "/home/students/") begin with same first letter as yours?
    Make a link to the "presidents/" file in my "final/" directory
    (or to link in my "bam/" directory), and use it for the next 5 items.
  5. In the "presidents/" file, how many lines do NOT contain the string "None"?
  6. How many lines do NOT contain either "John" OR "William"
  7. The 5th field contains a range of years separated with a dash, such as "(1861-1865), OR a single year, such as "(1841)".   How many lines have NO dash in this field.
  8. The 9th field also contains either a range of years or a single year. Count how many lines do NOT have a dash in this field.
Store your command history in a file named "h".

In your ~/final/ directory, write a bash script named   seven   that asks the user to enter a list of positive numbers, one per line, with a zero at the end of the list.

    As each positive value is read in, do the following:
  1. * Output the value, add it to total "t", and add one to counter "n".
  2. $ Update variables "hi" & "lo" to contain biggest & smallest values read in, so far.
    (HINT: Initialize both of these to the first value read in, before starting input loop.)
  3. $ Square each input number (i.e. multiply it by itself), and add that to a quantity called "ss" (for the sum of the squares).
    Do starred (*) items first;
    add "$" items later.
    When the zero is read in, do the following:
  1. * Be sure NOT to increase the counter!
  2. * Divide total (t) by counter (n), to compute average.
    (HINT: Don't worry about losing any fractions when these two integers are divided.)
  3. $ Set "tt" equal to the square of the total "t" (by multiplying t by itself).
  4. $ Set "diff" equal to ss - tt/n
  5. $ Compute the variance v = (ss - tt/n) / n   ( = diff / n )
  6. * Output the following (with approriate text to identfy each result):

    Test your script, with output to console, and input from keyboard; then run it with input from data files in ~martinb/final/ and output to files in your ~/final/ dir.
    Enter a list of positive values
    (ending the list with zero).
    Smallest: 11
    Biggest:  19
    Total is  135
    Count is  9
    Average:  15
    ss-tt/n=  2085 - 18225 / 9  = 60
    variance: 6
    Below are some tests you can perform:

    Input from ~martinb/final/data.1;
        and redirect output to your file seven.1.
    Input from ~martinb/final/data.2.
        and redirect output to seven.2.
    Input from ~martinb/final/data.3.
        and redirect output to seven.3.
    Input from ~martinb/final/data.4.
        and redirect output to seven.4.