Unix Assignment 3

Need assistance in completing a Unix  Scripting assignment. The assignment asks to write 2 scripts

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

 

Errors:

 

The value assignment to numfiles in fn_average and the directory processing in fn_filter both require filename expansion.  If you review 18.2 Globbing, in the Advanced Bash-Scripting Guide, you will get an idea how to do this. Also, please re-read the assignment instructions for the requested output format of this script.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

  

INSTRUCTOR: Ed Trembicki-Guy

STUDENT:

CCM
Dept:
IT

Course:
Introduction to UNIX

Course Number:
CMP 209

PAGE 1

INSTRUCTOR: Ed Trembicki-Guy

STUDENT:

CCM
Dept:
IT

Course:
Introduction to UNIX

Course Number:
CMP 209

PAGE 2

Assignment Week 12, November 14, 2013

When you have completed and tested the script files, return them as attachments in an email to me.

1. Write a bash script that will prompt the user for an integer value, and return the word representation of that value, similar to the format on a check. Examples:
42 Forty-two
714 Seven hundred fourteen
1345298 One million, three hundred forty-five thousand, two hundred ninety-eight
Use three functions, fn_main, fn_is_valid and fn_number_text. fn_main gets the user input and calls fn_is_valid and fn_number_text. fn_is_valid should test that the value is a positive integer less than ten million. fn_main should test the result of fn_is_valid and should exit the script with the appropriate error message if the value is not valid; otherwise, it should proceed to call fn_number_text. fn_number_text creates the word representation of the user-supplied integer value. The output should be:
Value {user supplied value} as text is {word representation}

2. Write a bash script, filter.sh, which prompts the user for a directory, and prints those files/directories within that directory, that have the size greater than the average file size of the directory. The du utility program with the -b option is one way to determine file size. Assuming the user-specified directory has five files/subdirectories with size in parentheses ” a(100) b(10) c(100) d(100) e(20)”, your program “filter.sh” should filter “a c d” since the size of each of the three files/directories “a c d” is greater than the average file size of 66 (330 total bytes / 5 files). Use three functions: fn_main, fn_average, and fn_filter. fn_main gets the user input and calls fn_average and fn_filter. fn_average computes the average file size of a directory. fn_filter filters out those that have less than the average. The output should be:
Results for directory: {user specified directory}
Total size of directory: {total bytes, e.g. 330 in above example}
Average file/subdirectory size: {computed average size in bytes}
Files with greater than average size:
{file1} {nn} bytes
{file2} {nn} bytes
{file3} {nn} bytes

{filen} {nn} bytes

PAGE

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER