Write a function that takes a single filename as an argument and adds execute permission to the file for the user.

$ function perms () {
> chmod u+x $1
> }

a. When might such a function be useful?
b. Revise the script so it takes one or more filenames as arguments and adds
execute permission for the user for each file argument.
c. What can you do to make the function available every time you log in?
d. Suppose that, in addition to having the function available on subsequent
login sessions, you want to make the function available in your current
shell. How would you do so?

a, When you are writing many shell scripts, it can be tedious to give many
chmod commands. This function speeds up the process.
b. $ function perms () {
> chmod u+x $*
> }
c. Put the function in ~/.bash_profile and/or ~/.bashrc to make it available
each time you log in (using bash).
d. Use source to execute the file you put the function in. For example:
$ source ~/.bash_profile

Computer Science & Information Technology

You might also like to view...

When enforcing referential integrity on fields with multiple values, you need to ensure that ________

A) the primary key and foreign key fields have not had any data entered into them B) the foreign key field has not had any data entered into it C) the primary key field has not had any data entered into it D) Referential integrity cannot be enforced on fields with multiple values

Computer Science & Information Technology

Before entering a loop to compute a running total, the program should first

a. set the accumulator variable to an initial value, often zero b. set all variables to zero c. read all the values into main memory d. know exactly how many values there are to total

Computer Science & Information Technology