For "sed" see
http://www.grymoire.com/Unix/Sed.html
For "AWK" see
http://www.grymoire.com/Unix/Awk.html
For "find" see
http://www.lowfatlinux.com/linux-find-files.html
See also
http://www.tldp.org/LDP/gs/node5.html
see also
http://www.thegeekstuff.com/tag/bash-tutorial/
See for "cut"
www.softpanorama.org/Tools/cut.shtml
Exercise
Ex. A
Write a bash shell script which reads a file containing user names
and creates home directories for the users (in a directory "home"
in your home directory) according to their names. If any name
appears more than one, change one name so each name is unique.
If the name is longer than 8 letters, truncate it. It should also
create the appropriate password file entry in a file called passwd
(also in your home directory). The program should take one parameter,
the file name. Only you should be able to run this program, use
environment variables to make sure who is running the program.
Ex. B
Write a shell script which adds users to the password file.
Make your own password file.
The script should make sure that the new account being made does not already
exist. It should check what is the next free uid and assign it to the new
account. If a password is not supplied in the command line, then take one
from an internal array. Encrypt the password by using shell16 above.
Also, handle errors, e.g. make sure only you can run the program.
Usage should be like this:
adduser [-p password] account_name
or also
adduser account_name [-p password]
where the [-p password] is an option.
© Nachum Danzig 17 Dec 2002