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.
Create 3 variables, VAR1, VAR2 and VAR3; initialize them to hold the values "thirteen", "13" and "Happy Birthday" respectively.
Display the values of all three variables.
Are these local or global variables?
Can you see the two remaining variables in a new terminal window?
Edit /etc/profile so that all users are greeted upon login (test this).
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.
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.
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!
Leave a Reply
You must be logged in to post a comment.