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

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
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??

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

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...

A(n) ________ spreadsheet can be inserted in a table

Fill in the blank(s) with correct word

Computer Science & Information Technology

The GNU Public License (GPL) promotes software that is free, as in “freedom.” How does the GPL provide such freedom?

What will be an ideal response?

Computer Science & Information Technology