Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Write a script which is passed a list of items (files, directories, links, etc) in the current directory as parameters. The script will iterate

image text in transcribed
4. Write a script which is passed a list of items (files, directories, links, etc) in the current directory as parameters. The script will iterate through this list, obtaining the long listing for each item and convert the permissions of the item into the 3-digit numeric equivalent. To accomplish this, you will have to store the permission portion in a variable. Assume the current filename is stored in the variable FILE. You can obtain the permissions using the following instruction permissions ls - SFILE awk print S1" The variable permissions will store the 11 characters in the permissions (the type of object, - for file, the 9 characters that make up the permissions, and a period that ends this sequence) You want to access characters 2-10. To access a single character, you can use notation like this S(permissions:INDEX:1 where INDEX is a number between 1 and 9 (recall that for this notation, the first character is at index 0). Now you want to look at the 3 sets of characters (1-3, 4-6, 7-9) and convert the r, w, and x into a value. You will need three separate sums, we can for instance call them first, second and third. If the character at index l is 'r', then add 4 to first, otherwise do nothing. If the character at index 2 is 'w', then add 2 to first, otherwise do nothing. And so forth. You might have if-then instructions that loolk like this: if Spermissions: 1:1r];then first S((first first+4)); fi

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

the role of webserver hacking and detection in penetration testing.

Answered: 1 week ago