Question: to this script called permplus.sh add the ability to add or remove permissions. if [[ $# -ne 3 ]]; then echo Need 3 parameters exit

to this script called permplus.sh add the ability to add or remove permissions.

if [[ $# -ne 3 ]]; then

echo "Need 3 parameters"

exit 1

fi

command="chmod $1+$2 $3"

echo "Adding permissions with the following command: ${command}"

$command

This is done by adding another argument to the script as shown below:

./permplus.sh    

Here, the first argument is the target set of permission bits (user, group, other, or all). The second argument is whether we are adding (a) or removing (r) the permission. The third is what permission (read, write, or execute). The fourth argument is a file or directory to modify.

Add checks for each of the arguments:

the first argument value is only u, g, o or a

the second argument value is only a or r

the third argument value is only r, w, or x

the fourth argument is a valid name (i.e. a valid file or directory).

Hint: These checks will augment the existing check in the if block above.

Be sure to print meaningful error messages

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!