need a shell script

Jon maddog Hall maddog at li.org
Sun Oct 12 09:08:14 EDT 2003


Jim,

iamspock1 at juno.com said:
> Can someone help me with a bourne shell script? I need to be able to
> add, edit, and delete users.  It is for a project that I am working
> on. I am just learning Linux, and am having a lot of fun doing it.

I can imagine a person with the email name "iamspock1" having fun with learning
Linux....welcome.

You did not say why you wanted to write a shell script for this.  If it is
just to practice shell scripting, that is one thing, but if it is to do useful
work, then you should learn the first law of Unix and Linux:

Don't re-invent the wheel

with its corollary:

"Good programmers write good code, great programmers 'steal' good code."
					- Mike Gancarz

[Mike said the word "steal", which I never liked, since "stealing" Open Source
code, which is freely given and shown, is a tough concept and gives a bad
image.  I prefer the word 'copy', instead of 'steal'.]

Most Unix and Linux systems have a shell-level command for adding, editing and
deleting users.

Depending on the distribution they are called "adduser" or "useradd", with
a corresponding "deluser or "userdel" command.  In Red Hat they are
"useradd" and "userdel".  By using various options you can change various
types of information in the appropriate files.

While "useradd" in Red Hat is a "C" program instead of a shell script, you
could look at its code to determine which files you have to change, and in
what order, etc.

Warmest regards,

md
-- 
Jon "maddog" Hall
Executive Director           Linux(R) International
email: maddog at li.org         80 Amherst St. 
Voice: +1.603.672.4557       Amherst, N.H. 03031-3032 U.S.A.
WWW: http://www.li.org

Board Member: Uniforum Association, USENIX Association

(R)Linux is a registered trademark of Linus Torvalds in several countries.
UNIX is a registered trademark of The Open Group in the US and other countries.




More information about the gnhlug-discuss mailing list