Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a script called activity4.2-5 that checks whether you can execute a file w

ID: 3817488 • Letter: W

Question

Write a script called activity4.2-5 that checks whether you can execute a file whose pathname is provided by the user. If you cannot, your script should add read and execute permissions for the user and group. If you can execute, the script should ensure that the user and group have rwx while others can only read the file. In either case, you should display the permissions before and after you’ve changed them.

Include a rst line that calls the bash shell as the interpreter

Add a comment to state the purpose of the script and other comments to make the script easier to read

Explanation / Answer

#!/bin/bash echo -n "Enter the file name :" read fname # check if the file exits if test -f $fname then # check for all conditions if test -r $fname && test -w $fname && test -x $fname && test -prem -004 $fname then echo "Read,write,execute allowed " else # allow user and group to read and execute chmod ug+rx $fname fi fi

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote