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

  Analyze the security features of linux

Analyze the security features of Linux, Macintosh, and Windows operating systems, and decide which you believe is the most susceptible to hackers based on hacking techniques and attack vectors. Justify your response

  How can the evolution of os benefit an organization

Why are there so many versions of OS. This will be the foundation for future discussions by your classmates. Be substantive and clear, and use examples to reinforce your ideas.

  What is difference between historic and new bsd release unix

What is major difference between the Historic Unix and the new BSD release of Unix System V in terms of Memory Management?

  Provide your own redirection command syntax example

State the purpose of each of three I/O forms including which file descriptor is used for each one. Provide your own redirection command syntax example as well as description what your command syntax will do.

  Creating the source code and flowchart

Construct a C program that displays a title, "Hello World." Insert comments in the event to document the program internally. Attach a design flow chart.

  Why use threads and explain a complication that concurrent

why use threads? and explain a complication that concurrent processing adds to an operating system.provide support for

  A portable file system i would like to solve the problem by

i would like to solve the problem by using c ltbrgtplease fellow requirements as well as also deliver it on time.

  List the steps for selecting and replacing a power supply

List the steps for selecting and replacing a power supply in a desktop computer that will require a minimum of 1,200 watts of power. Include the choice of a power supply that meets the needs of the system.

  Specify the order in which processes execute

Specify the order in which processes execute and determine the mean process turnaround time for each of the scheduling algorithms.

  Display pid of manager process

Display PID of Manager process - Create children processes as students and you can add or modify the procedure as long as your program does not disobey the main requirements.

  File compression

Research the Internet or create your own files which meet the following criteria: a) gzip compresses by more than 80 percent b) gzip compresses by less than 10 percent

  Which declaration of x is the correct one for a reference

Assuming static scoping, which declaration of X is the correct one for a reference to X in the following

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