Stephen Gran on 5 Feb 2010 16:12:57 -0800


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

Re: [PLUG] Equivalent of id for groups


On Fri, Feb 05, 2010 at 06:30:00PM -0500, K.S. Bhaskar said:
> I can use the id command in a shell script to determine whether a user
> is valid, e.g.,
> 
> $ id -u auntsue
> 9999
> $ id -u xyzzy
> id: xyzzy: No such user
> 
> Is there an equivalent command to check for the validity of a group
> name?  I can't scan /etc/group because the group may be defined by
> NIS.  Ideally, it should be something that will work on Linux as well
> as UNIX flavors.

getent group xyzzy
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | I am here by the will of the people and |
|  steve@lobefin.net             | I won't leave until I get my raincoat   |
|  http://www.lobefin.net/~steve | back.   -- a slogan of the anarchists   |
|                                | in Richard Kadrey's "Metrophage"        |
 --------------------------------------------------------------------------

Attachment: signature.asc
Description: Digital signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug