[CentOS] Slightly OT: check creation of a group

Kwan Lowe kwan.lowe at gmail.com
Mon Mar 1 16:14:18 UTC 2010

On Mon, Mar 1, 2010 at 11:08 AM, Laurent Wandrebeck
<l.wandrebeck at gmail.com> wrote:

>> Niki
> Why don't you use groupadd -f ? It will not override the group if it
> already exists, and shortens the code :)

That gets my vote :)

I have seen code that creates a temp file then does a chgrp on the
file. If it fails then the group is created. If not, the existing
group was used. This was done to get around some differences between
SunOS and Linux and unknown state of LDAP/local auth.

More information about the CentOS mailing list