3.8. Exercises

For this exercise, you will need to read the useradd man pages, because we are going to use the /etc/skel directory to hold default shell configuration files, which are copied to the home directory of each newly added user.

First we will do some general exercises on setting and displaying variables.

  1. Create 3 variables, VAR1, VAR2 and VAR3; initialize them to hold the values "thirteen", "13" and "Happy Birthday" respectively.

  2. Display the values of all three variables.

  3. Are these local or global variables?

  4. Remove VAR3.

  5. Can you see the two remaining variables in a new terminal window?

  6. Edit /etc/profile so that all users are greeted upon login (test this).

  7. For the root account, set the prompt to something like "Danger!! root is doing stuff in \w", preferably in a bright color such as red or pink or in reverse video mode.

  8. Make sure that newly created users also get a nice personalized prompt which informs them on which system in which directory they are working. Test your changes by adding a new user and logging in as that user.

  9. Write a script in which you assign two integer values to two variables. The script should calculate the surface of a rectangle which has these proportions. It should be aired with comments and generate elegant output.

Don't forget to chmod your scripts!

Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:57:32