bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getpwnam


From: Bruce Korb
Subject: Re: getpwnam
Date: Thu, 01 Jan 2004 11:52:52 -0800

Hi Andreas,

Andreas Schwab wrote:
> >>   getent passwd bob
> >>   bob:x:1000:1000:Bob Proulx,,,:/home/bob:/bin/bash
> >
> > 1.  you cannot get it by user id,
> 
> Yes, you can.

OK.  I only read the man/info pages.  I haven't read the source.
I don't intend to, either.  :-}

> > 2.  you must still know that the comment is the 5th field, for example
> >     and parse the line.  Thus, getent isn't any better than:
> >        egrep '^bob:' /etc/passwd
> 
> Of course it is, think of NIS, LDAP, etc.

OK.  It still isn't much fun working awk-ward scripts and having to remember
how many colons you gotta skip over.  This is too much easier:

$ getpwnam -A
bkorb x 500 dev 501 Bruce Korb /home/bkorb /bin/ksh
$ getpwnam -VA
user name:    bkorb
password:     'x' (encrypted)
user id:      500
group name:   dev
group id:     501
full name:    Bruce Korb
directory:    /home/bkorb
login shell:  /bin/ksh




reply via email to

[Prev in Thread] Current Thread [Next in Thread]