Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Operating System Expert

Topic: Unix

Write a bash shell script, called perm, that satisfies the following requirements:

1. Usage: perm [ dir-name ]

2. perm displays the permissions of a directory and all the directories in the directory's absolute path. perm will also show other information about the directories, as the cursor is moved up and down the list of directory names. perm will also facilitate changing permissions of the directories, assuming that you are the owner of the appropriate directory or the superuser.

3. perm will accept one argument, the name of a directory, including the path if required.

4. If there is no argument specified, then the current directory will be the default.

5. If there is more than one argument specified, there will be an error message and the script terminated (exit status 1) with no full-screen display.

6. If the specified filename is not a valid, existing directory, there will be an error message and the script terminated (exit status 1) with no full-screen display.

7. Please see the examples for the exact display format, and match this format as closely as possible. Note that the screen is cleared before full-screen output is displayed. There are 3 spaces between the permission groups, and between the permission groups and the filename. There is one space between the permissions within a permission group.

8. Ignore the situation of a very deep directory structure, which would require a multi-screen display.

9. Do not let output lines wrap to the next line, ensure that all lines are truncated to the width of the screen size.

10. Once your program is running, you do NOT have to take into account changes in screen size. You also do NOT have to take into account changes performed from another process, such as changes in permissions of the displayed directories or changes in the displayed directory structure.

11. On initial display, the cursor will be on the first character of the specified (or default) filename. Information for this directory will also be displayed.

12. There are three lines showing the valid keys accepted during execution of the perm command, on the fourth, third, and second lines from the bottom of the terminal window, regardless of the terminal window size used.

13. After the initial display, the valid keys available are the following. Note that there should be no "enter" key required after any of them, and that they are lower case:

  • "k" will move the cursor to the line containing the filename above the current line. Also, information for the new directory level will be displayed, instead of the previous directory level. This key will have no affect if the cursor is already on the top-most filename, which will be the root.
  • "j" will move the cursor to the line containing the filename below the current line. Also, information for the new directory level will be displayed, instead of the previous directory level. This key will have no affect if the cursor is already on the bottom-most filename, which will be the specified (or default) directory.
  • "h" will move the cursor to the field immediately to the left of the current field. This key will have no affect if the cursor is already on the "r" permission position for "owner". The fields are the nine permission fields, and the filename.
  • "l" will move the cursor to the field immediately to the right of the current field. This key will have no effect if the cursor is already on the right-most field, which will be the filename.
  • "r" will set read permission to the current filename, for owner, group, or other, depending on which field the cursor is on. If the cursor is on any field other than one of the three "r" fields, then the "r" key will be ignored.
  • "w" will set write permission to the current filename, for owner, group, or other, depending on which field the cursor is on. If the cursor is on any field other than one of the three "w" fields, then the "w" key will be ignored.
  • "x" will set execute permission to the current filename, for owner, group, or other, depending on which field the cursor is on. If the cursor is on any field other than one of the three "x" fields, then the "x" key will be ignored.
  • "-" will remove a permission to the current filename, for owner, group, or other, depending on which field the cursor is on. If the cursor is on any field other than one of the nine permission fields, then the "-" key will be ignored.
  • "q" will terminate the perm script. Note that the screen is not cleared, and the command prompt will appear on the bottom line of the terminal window.
  • -c will have exactly the same effect as "q"

14. Any keys entered, other than the valid keys above, will be ignored.

15. If the user doesn't have authority to change a permission, then the "r", "w", "x", and "-" keystrokes will be ignored. If the permission could be changed, then the output display will reflect the new permission.

16. When moving down or up, the cursor will be on the same field on the new line as on the current one.

17. "Flashing" of the screen, during cursor movement, is OK. For example, when the cursor is moved up or down, you may redraw the entire screen. If you wish to eliminate the flashing, making the program more pleasant to use, you may do so, but it will slightly increase the complexity of your program.

18. If perm produced full-screen output, it must end with an exit status of zero. If there was an error, then there is no full-screen output, and the exit status should be one.

19. Ensure that your script is self-contained in one script file, called perm

20. Don't do any argument verification or any processing in perm other than that specified above. If you're interested in adding more capabilities, please do so in a different script.

Operating System, Computer Science

  • Category:- Operating System
  • Reference No.:- M92278993

Have any Question?


Related Questions in Operating System

Question note apa format 250 words and three reference

Question: Note: APA format 250 words and three reference without plagarism Computerized Operating Systems (OS) are almost everywhere. We encounter them when we use out laptop or desktop computer. We use them when we use ...

Taskyour job in this assignment is to create two virtual

Task Your job in this assignment is to create two Virtual machines each running a different but the latest distribution of Linux e.g. Ubuntu Server and CentOS. Each of these VM's is to offer services to a user base. The ...

Research types of operating systems that are currently

Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Explain why you think the choice you made ...

Question state the required answer precisely and then

Question : State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. What is the purpose of the command interpreter? Why is it usually separate fr ...

Question students working at individual pcs in a computer

Question : Students working at individual PC's in a computer laboratory send their files to be printed by a server that spools the files on its hard disk. Under what conditions may a deadlock occur if the disk space for ...

Question description of lasa in this assignment you will

Question: Description of LASA: In this assignment, you will select a real-world operating system (can be for a PC, server, tablet, handheld, or embedded device). You will introduce the operating system and its components ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Consider a computer embedded in the control of a manned spacecraft. Would it require an ...

Question research hex editors available for mac os and

Question : Research hex editors available for Mac OS and Linux. Based on the documentation, how easy would validating these tools be? Select at least two hex editors for each OS, and discuss what you would do to validate ...

State the required answer precisely and then provide proper

State the required answer precisely and then provide proper explanation. It is not enough to provide one- word or one-line answers. Briefly describe the following concepts and indicate how they are related in the context ...

Foundation of information technologyresearch types of

Foundation of Information Technology Research types of operating systems that are currently available and provide a scenario in which the operating system you chose would be appropriate to be used in this situation. Expl ...

  • 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