Using Bash, Find script files in a directory or subdirectories within...
Hi, I doing an exercise which is looked like this:
"You are required to write a script using Bash, which can find out all the script programs under a directory and its subdirectories and then change its mode to be executable. Your script needs to satisfy the following requirements:
(a) test if the number of arguments is bigger than 1. Print out a usage message if the number of argument is 1.
(b) it can be run by the super user: root only.
(c) Before it changes file's mode, it should ask the user to confirm.
(d) It needs to print out the path of all the scripts whose permission have been modified. "
For part (a), i can use variable $1 to test if there is an argument.
For part (b), i can check using $UID=0, since root is always 0
For part (c), i just print a message and if the input is y for yes, then i continue, else i just use 'exit 0' to exit fomr this script
please correct me if i was wrong
Now the problem is i had no idea how to search for all the sript programs within the directory and its subdirectories. i also got no idea for part (d).
I would really appreaciate for any good advices given.