Overview: Linux/Unix Scripting is a very important skill to have when working as
ID: 3868505 • Letter: O
Question
Overview: Linux/Unix Scripting is a very important skill to have when working as a *NIX system administrator and one that will make your day much less tedious and much more efficient. This final submission is the last piece of your final assessment and will build on the skills you have utilized over the previous four milestones.
Prompt: For this final submission, you will submit your UNIX/Linux Task Training Aid in its final form, addressing all critical elements in the Final Project Document. You may also modify the previous milestones for resubmission. Paste your previous milestones into this template, below, and highlight areas of change.
Specifically, the following critical elements must be addressed in this submission:
Fully Functional Script
In this section, you will write a fully functional script to help your manager with an important project that will build upon what you learned from your script work in Milestone Four. After you have written the script, you will execute it to generate a report for all three users (once for Bob, once for Henry, and once for Frank). You should have three unique generated reports in your ~/scripts directory (or more if you ran it multiple times per user). This script will be showcased to upper management and should demonstrate your best work.
Write the Script: Write a fully functional and professional looking script that meets all of the following requirements.
Resides within your ~/scripts directory and is named tps-report-gen.sh.
Take a supplied user's first name (Bob, Henry, or Frank) in any order when the script is executed (for example: sh tps-report-gen.sh bob).
Print out to the screen the text: TPS REPORT LISTING
A double newline.
Print out to the screen neatly the user’s name, company position, and home directory path on one line.
A double newline.
A list of TPS Reports associated with that user.
A double newline.
Print out to the screen the text: END REPORT LISTING
The script needs to print the output to the screen and generate a report into the same directory as the script named tps-list-USER-DATETIME.rpt. USER would be the user's username and DATETIME would be the date and time that the report was run. USER and DATETIME would both change based on the username supplied and the date and time the script is executed. It may be easier to build the report file first, then simply cat the file to the screen within the script. An example report would look like:
tps-list-bob-030816624.rpt
HINT: To format the DATETIME portion as requested, use the following:
date "+%m%d%y%k%M" | awk -F" " {'print $1$2'}
Explanation / Answer
I have coded the shell script based on the information available in question provided. I dont have the information on how sample report should look like and also the data related to "A list of TPS Reports associated with that user."
So if you can provide me those information through some shared pastebin websites it would be great. I will modify and provide the code to you.
Note that home directory is '/' in my terminal but it should give correct home directory in your system if you have the HOME directory set.
Code:
http://pasted.co/a671c755
Code output screenshot:
https://pasteboard.co/GFZzzvc.png
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.