271 Extra script homework - optional
Do this if you want to make up missed homework or if you want to take a midterm
challege test to regain up to 60% of your lost points. This assignment is your
ticket to being allowed to take the midterm challenge.
Hand in all 4 scripts together to moodle. You will get credit
for 2 missed homeworks by handing in fully working scripts complete with
error checking of user input. The error checking will make these scripts a little
longer than prior homework. Partial credit is possible, but late
work will not be accepted.
Once you hand this in with working code, you are
eligible to take a midterm challenge test to regain up
to 60% of your lost points. You need to email me to work out a time to
take this challenge test as it needs to be taken outside class. The challenge
test has to be taken within 2 weeks of handing in this assignment. The test
will not include Perl and will be more construction than multiple choice.
--------
For all scripts, give an error if the correct number of parameters are not
sent. In that error, describe the expected parameters. When there is an error,
give an error message and exit with a number other than 0.
1) Directory copy script: copy all files named with certain letters to another
directory
- Input parameter 1: The directory name that you will copy from. (source)
- Input parameter 2: The directory name that you will copy to. (destination)
- Input parameter 3 : something every file you are copying will contain in
its name
- Process: Copy the files that match input parameter 3 and are in input paramter
1 to input parameter 2. and then list the files in the new directory and then
show that directory path using pwd.
- Errors to catch: no files to copy, parm 1 or 2 not a directory. parm 3 missing.
2) Directory match script: list all files that are found in one directory but
not the other, or vice versa.
- Input parameter 1: The first directory for comparison
- Input parameter 2: The second directory for comparison
- Process: List one row for each file that only exists in one of the two directories.
On each row, list the filename and the directory that it is found in. At the
bottom, list the total count of files in each directory.
- Errors to catch: no files to copy, parm 1 or 2 not a directory, no files
with differences, no files to check.
3) Differences identification script: directory comparison of file contents
tool. The comparison output should be written to a file named diff.out.
- Input parameter 1: The first directory for comparison
- Input parameter 2: The second directory for comparison
- Input parameter 3: something every file you are comparing will contain in
its name.
- Input parameter 4: a = all; s = line only exists in first and not second;
d= line only exists in second and not first
- Process: Diff all the files matching parm3 in the first directory against
the same filename in the second directory. If parm 4 is a, just list all the
differences of all files, which would be the diff output. If parm 4 is s,
list all the lines beginning with > and for parm 4 of d, list all lines
beginning with < . The difference output should go to file diff.out. Also,
write the number of files diffed to the user's screen and a message to check
diff.out for their output.
- Errors: Any problem with parameters, including directory not found or no
files to compare.
4) Any script you would find useful that no other student already submitted.