Bruce Korb <[EMAIL PROTECTED]> writes: > 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.
getent uses the same interfaces as getpwnam, getpwuid, etc. >> > 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 The output of getent is much easier to parse than both of your examples. The first form is ambigous, and in the second form the tag names likely change due to i18n. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux AG, Maxfeldstra�e 5, 90409 N�rnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." _______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-coreutils
