首页 > > 详细

辅导ACIT2420、讲解Python/c++程序设计、Java/Python设计辅导、讲解Red Hat System 解析C/C++编程

ACIT2420 Midterm – Oct 16, 2018
The ACIT2420 midterm is a hands-on test, having you complete three shell scripts to address
common tasks similar to those you have encountered in Chapters 1-6 in the Red Hat System
Administration I student guide.
Grading: Each of the scripts will be graded for completeness, correctness, conciseness, and
readability, each of those on a scale of 0-4. With four components to each script grade, that
means a possible score of 16 for an individual script, and 48 marks in total.
completeness refers to the number of feature points that you addressed for a script;
correctness refers to the proper functioning of your script, as it addresses the feature
points;
conciseness refers to the number of executable script lines you use for each feature
point; there are several which could be addressed over multiple statements (correct)
yet which have a single line equivalent (concise); and
readability refers to how clear and easy-to-read your scripts are; comments & indenting
help a lot
If you don’t make mistakes, it should be easy to get 3 out of 4 for any grade component.
Getting 4 out of 4 could take a bit more effort.
Permitted: this is an open-book exam. Feel free to search online, but be cautioned that you
will not have time to look up the answer to every question.
Not permitted: no “ask a friend” is permitted. If we see any evidence of messaging, incoming
or outgoing, explicit or accidental, using an app or website, you will be disqualified on the
spot. Close your messaging, email and social media apps on all your devices before starting
the test. Mute your devices or turn them off during the exam, please.
The exception to this is our slack channel, where I will be loitering to answer any
questions that come up during the exam. This is not giving you permission to harass your
classmates or anyone other than me, for that matter.
Submission: a “midterm” dropbox is provided on D2L. Submit your shell scripts there, either
individually or zipped up. The dropbox has a due date/time of 10:30, giving you two hours to
complete these scripts.
Requirements are shown following.Script #1: Xmas Wish List (file management)
With Christmas rapidly approaching, I am sure you are starting to think of your xmas wish list,
namely a list of candidate gifts that you are going to tell potential gift buyers about. This script
creates the initial set of lists, one per hopeful gifter. Each list will have a single item on it when
you are done. This xmas wish list will help you track what you have asked for, and from
whom, to help avoid duplicates.
Your script shall:
- remove any existing wish list folder in your home directory, and create a new one
- create subfolders inside it for your gifter groups – family, relatives, and friends.
- in the family folder, create text files named for each potential gifter. For family, that would be
mom, dad, brother John, and sister Theresa.
- for relatives, that would be Auntie Jemima, Uncle Tom, and cousin Joe-Bob.
- friends would include Larry, Curly, Moe & Sally.
- the initial wish list for mom should be cookies, a laptop from dad, a Steam gift card from
John, and a messenger bag from Theresa
- the initial wish lists for relatives should all be for money
- the initial wish list items for friends should be gift cards for Starbucks
Example:
~/wishlist/family/dad could be a text file containing “laptop”
Hint 1: the above order does not have to be followed exactly
Hint 2: use globbing for conciseness
Script #2: Old McDonald (scripting)
This is a twist on the classic “Old McDonald Had a Farm” - a script that will show a vowel line
phonetically, to help kids learn more readily.
Your script should take up to 5 vowel arguments, in any order, and create and display a
phonetic string, with the sounds separated by dashes. Use “hay” for “a”, “eee” for “e”, “eye” for
“i”, “oh” for “o”, and “you” for “u”. Substitute “oops” for any non vowels.
Examples:
- “./sing e i e i o” would produce “eee-eye-eee-eye-oh”
- “./sing b e i i” would produce “oops-eee-eye-eye”
Hint: use getopts for readabilityScript #3: Donald Duck’s $M Killer App (managing users)
Donald Duck has a killer idea to get rich: a script to create a set of users and folders for a
typical family. The family assumes two parents (“mama” and “papa”) and from 1 to 3 children.
The script would be invoked as
./setup Ducks mama papa Huey Dewey Louie
where the first parameter is the family name, the second and third are the names of the
parents (most responsible first), and then up to three child names. If this is a single parent
family, designate another responsible adult (eg. grampa) as the third parameter.
If no children are given, tell the user they don’t need to complicate things, and stop.
If the two parent names are the same, tell the user they need to find someone responsible,
and stop.
If any of the child names are the same as another, tell the user they need to be more creative
naming their children, and stop.
Make sure that the individual user home folders alow no one else to see inside them (other
than root). Create new user accounts for the parents and all the children specified. They can
have an initial password of “secret123”, but force that to be changed when they first login.
Create a new group, named the same as the family name. Create a family-named folder
directly inside /home, with the owner being the most responsible parent, and with read &
execute rights given to the family group. Add all the users to the family group.
The sample invocation above would result in six new folders inside /home, five individually
owned and one managed by mama but visible to and readable by the rest of the family.
The user running this script will be logged in as root. There shall be no prompting for input –
all the magic happens in your script.

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!