Sale!

COMP-206 Mini Assignment #2 solved

$35.00 $21.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Command-line Bash Script
Create a script called MakeProject.sh that will be used by you to automate the process of
creating well formed software development directories.
This bash script will be used at the command-line as follows: ./MakeProject.sh name
Where name is provided by the user at the command-line and is the project name. The
project name must be a single word (it cannot have spaces or other white characters).
The script will do the following in this order:
• Using absolute path the script changes directory to your home directory.
• Next it verifies whether a subdirectory called project exists. If it does not exist it
creates that directory.
• Next it changes directory moving into the project subdirectory using relative path.
• Next it verifies whether a subdirectory called cs206 exists. If it does not exist it
creates that directory.
• Next it changes directory moving into the cs206 subdirectory using relative path.
• Next it verifies whether a subdirectory called name (ie. The word the user
provided at the command-line) exists.
o If it does exist then the script terminates with an error message: “This
project name has already been used.”.
o If it does not exit, it then creates the subdirectory and below that directory
it creates the following additional subdirectories within the project
directory: archive, backup, docs, assets, database, and source.
• Next it changes directory moving into the source subdirectory using relative path.
• Finally, the bash script generates (does not copy from another location) a Bash
script file called backup.sh and this script file simply copies all the files with the
file extension .c and .h into the backup directory using relative paths. The user
would run this script from within the source directory by typing: ./backup.sh
• The script terminates by displaying: “You project directories have been created.”
WHAT TO HAND IN
Everything must be submitted to My Courses before the due date. Remember that you
can hand in your assignment up to two days late but there will be a penalty of 5% each
day. After that, your assignment will not be accepted. Please hand in the following:
• A single Bash script called MakeProject.sh
HOW IT WILL BE GRADED
The assignment is worth a total of 20 points.
o 4 points – Changing directories
o 5 points – Testing existence of directories
o 4 points – Creating directories
o 2 points – Displaying error messages
o 5 points – Creating the backup.sh script programmatically
GRADING RULES
The following rules are followed by the TA when grading assignments:
• A program must run in order to get a grade (even if it does not run well). If it
does not run (does not compile) it will receive a zero. (Make sure to run your
programs from Trottier – they sometimes do not run the same from home when
logging in using putty.)
• The TA will grade using the linux.cs.mcgill.ca server.
• All questions are graded proportionally (assuming the program runs at all). This
means that if 40% of the question is correct, you will receive 40% of the grade.