Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Assignment

Objective

To practice with shell scripting, and learn the basic skills to write shell scripts that perform simple tasks involving the monitoring of directories and files.

Task

A given UNIX directory may contain many files and subdirectories. For the purpose of this assignment, a "file" is a non-directory file, and a directory is a subdirectory of the given directory. Each file or directory might have different permissions. For example, a file might have read and execute permissions for the owner. A directory might have only read permission.

In this assignment, you will write a shell script that calculates the following information for the contents of a given directory. The directory that you will analyze will be passed in as a single command line argument to your script. You don't need to account for any contents of nested subdirectories -- just the direct contents of the specified directory passed in as a directory.

1. The total number of directories that are in directory passed as a parameter.
2. The total number of files in the given passed directory.
3. The number of items (files/directories) in the directory (passed as a parameter) that are readable.
4. The number of items (files/directories) in the directory (passed as a parameter) that are writable.
5. The number of items (files/directories) in the directory(passed as a parameter) that are executable.

Note that any hidden files or hidden directories are not included in this count. For example, ".."_ represents the parent directory of the current directory and is not counted as a directory or as a file. Similarly, ".login"_ would not be counted. Only regular files and directories in the given directory are calculated.

Requirements

• The script should be named assignment6.sh
• The script must be written to run under the bash shell!
• Your script must check for the correct number of arguments (one argument). If somebody tries to invoke the script without passing in the correct number of arguments, then output this usage message and abort the script:

Usage: assignment6.sh

• Your script must also check that the command line argument actually exists and is a valid directory (any directory). If it is not, then output an appropriate error message, and end the script processing. Example: If the user inputs a parameter that is not a directory you should issue the following message.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92267060
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Suppose you have used the following production function to

Suppose you have used the following Production Function to estimate the Industry's average and marginal products for its inputs: Q = 150 L 1/4 K 1/3  M 1/5. Where Q stands for output; L is labor; K is capital (machine ho ...

Take the input of numbers and reverse the order of elements

Take the input of numbers and reverse the order of elements in that vector using recursion.

Question suppose you are considering an improvement to a

Question : Suppose you are considering an improvement to a computer program. The improvement is applicable only to a fraction 35% of the program and the speedup of the improved fraction is 15. What is the overall speedup ...

Suppose that a data warehouse consists of the four

Suppose that a data warehouse consists of the four dimensions date, spectator, location, and game, and the two measures count and charge, where charge is the fare that a spectator pays when watching a game on a given dat ...

Suppose two nodes a and b are attached to opposite ends of

Suppose two nodes, A and B, are attached to opposite ends of an 800 m cable, and that they each have one frame of 1, 500 bits (including all headers and preambles) to send to each other. Both nodes attempt to transmit at ...

Mary kate is a project manager in the it department for a

Mary Kate is a project manager in the IT department for a university. She has been asked to manage a project to create faculty intranet. The university has multiple campuses in various locations, and professors and other ...

A street vendor is asking people to play a simple game you

A street vendor is asking people to play a simple game. You roll a pair of dice. If the sum on the dice is 10 or higher, you win $10. If you roll a pair of 1's, you win $59. Otherwise you lose $5. If the random variable ...

Is smartart graphic and table slide important for

Is Smartart graphic and Table slide important for PowerPoint Presentation? How would it benefit?

Question suppose you are starting work on a project for an

Question : Suppose you are starting work on a project for an organization that has never used any modeling techniques or tools in designing a system. (Yes, it is hard to imagine, but it does exist.) Your manager is reluc ...

Questions -question 1 a digital computer has a memory unit

Questions - Question 1: A digital computer has a memory unit with 16 bits per word. The instruction set consists of 122 different operations. All instructions have an operation code part (opcode) and an address part (all ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As