YP answer (was Re: awk and shell question)

MIDI Apprentice limes at ouroborous.Eng.Sun.COM
Tue Sep 19 06:27:02 AEST 1989


In article <2130 at munnari.oz.au> ok at cs.mu.oz.au (Richard O'Keefe) writes:
>In article <2412 at netcom.UUCP>, hinton at netcom.UUCP (Greg Hinton) writes:
>: In article <1163 at ispi.UUCP> jbayer at ispi.UUCP (Jonathan Bayer) writes:
>: >I have to get the user id, and then get the user description from /etc/passwd.
>Again, watch out for Yellow Pages; if you're using that you have to do
>	ypcat passwd | grep "^${LOGNAME}" | what-ever-you-want-here

Assuming that a YP lookup operation is more efficient then doing a YP
database dump and groveling through it with grep, the following will
probably be somewhat faster (my passwd map is around 2500 entries):

	ypmatch $LOGNAME passwd | cut -f5 -d:

Add error checking [and salt] to taste.
-- Greg Limes	limes at sun.com	...!sun!limes	73327,2473	[choose one]



More information about the Comp.unix.wizards mailing list