Assignment #1
Due Midnight, Wednesday Sept. 17, 1997
Implement the following utility using either the Bourne "sh" or Berkeley "csh"
NAME
pchmod - change the permissions mode of a path
SYNOPSIS
pchmod args
DESCRIPTION
The args of pchmod are identical to the args of chmod(1) with the following
restriction: the object files specified in args should EXIST and does NOT contain any "/".
pchmod give an error message and exits if any of the object files contains "/".
pchmod makes sure that all directories leading to the object files
are world executable.
Example 1:
% cd /home/cs476/.Fall95/submissions/assign4
% pchmod -R a+rx fraser.0
The program will in-effect do the following:
% chmod o+x /home
chmod: WARNING: can't change /home
% chmod o+x /home/cs476
% chmod o+x /home/cs476/.Fall95
% chmod o+x /home/cs476/.Fall95/submissions
% chmod o+x /home/cs476/.Fall95/submissions/assign4
% chmod -R a+rx fraser.0
%
Note that your program should ignore all errors/warning generated
from using chmod(1).
Example 2:
% pchmod -R a+rx frser.0
pchmod: ERROR: frser.0 does not exist
%
Example 3:
% pchmod a+r /home/cs476
pchmod: ERROR: do not use "/" in args
%
SEE ALSO
pwd, tr, grep
Back to Assignments Page
Back to CS476/576 Home Page