Write a bash shell script called perm

Assignment Help Operating System
Reference no: EM131470255

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.
  • <Ctrl>-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.

Reference no: EM131470255

Questions Cloud

What is the difference between remedies at law and in equity : What is the difference between remedies at law and remedies in equity?
Determine two specific internal factor that the leaders need : Determine two specific internal factors that the organization's leaders need to consider in preparing for future of health care and the future of organization.
Organize your thoughts and themes : As you continue to read widely but selectively in your topic area, consider instead what themes or issues connect your sources together. Do not try to cover all the topics
Define the philosophy of law : Philosophy of Law. After World War II ended in 1945, an international tribunal of judges convened at Nuremberg, Germany. The judges convicted several Nazi war.
Write a bash shell script called perm : Write a bash shell script, called perm, that satisfies the following requirements: perm will accept one argument, the name of a directory, including the path
Which source of law takes priority in given situations : This chapter discussed a number of sources of American law. Which source of law takes priority in each of the following situations, and why?
Count the occurrences of string : $MyGrep -c "This is a list of words" test.txt Count the occurrences of string "This is a list of words" in the content of file test.txt
What kind of spectra are those in group a : What kind of spectra are those in Group A? What kind are Group B? There is a third type of spectrum. Name it, and explain what causes that kind.
Develop the preliminary investigation report : IFSM 461: Systems Analysis and Design - develop the Preliminary Investigation Report (PIR), which will examine the problems/opportunities.

Reviews

Write a Review

Operating System Questions & Answers

  Implementation of algorithms for process management

The Shortest Job Next (SJN) algorithm queues processes in a way that the ones that use the shortest CPU cycle will be selected for running rst.

  Develop a user mode command interpreter

Develop a user mode command interpreter which support list-short.

  Memory allocation in operating system

Analysis and implementation of algorithms for memory allocation in operating system, Explain First- t and best- t methods are used in memory allocation in operating systems.

  Stand alone child process

Forking the child process

  Write a multi-threaded program

Write a multi-threaded program to solve producer and consumer problem

  Marginal and average cost curves

n a competitive market place (pure competition) is it possible to continually sell your product at a price above the average cost of production.

  Simulating operating systems scheduling

Simulate the long-term scheduler, the short-term scheduler and the I/O scheduler of the computer using the First-Come-First-Serve algorithm.

  Issues with trusted platform module

Research paper discussing the issues with Trusted Platform Module (TPM)

  Threads

Explain a complication that concurrent processing adds to an operating system.

  Design and programming

Use the semaphore methods to control the concurrency of the solution

  Virtual machines

Virtual machines supported by a host operating system

  Discuss an application that benefits barrier synchronization

Discuss an application that would benefit from the use of barrier synchronization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd