Question
Write a PERL program that accepts a directory name on the command line. The program checks that there is exactly one command line argument, then
Write a PERL program that accepts a directory name on the command line.
The program checks that there is exactly one command line argument, then calls a sub. The sub finds all files in the directory that have 700 access permission (the owner has full permission, group and other users have no permission), and changes the access rights for these files so that everyone else can read the file (744 permission). The sub then prints the name and new access rights of all the changed files.
Sample output:
$ ls -l dir1 total 5 -rw-rw-rw- 1 ucn2140 staff 1970 Mar 3 16:24 lab3 -rw-rw-rw- 1 ucn2140 staff 298 Mar 3 16:24 lab3.soln1 -rw-rw-rw- 1 ucn2140 staff 306 Mar 3 16:24 lab3.soln2 -rwx------ 1 ucn2140 staff 553 Mar 3 17:21 lab4.soln1 -rwx------ 1 ucn2140 staff 180 Mar 3 17:21 lab4.soln2 $ lab6.soln2 dir1 dir1/lab4.soln1 744 dir1/lab4.soln2 744 $ lab6.soln2 Usage: lab6.soln2 dirname
Turn in directory listings before and after your program runs, as well as the perl code and results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started