[CentOS] Slightly OT: check creation of a group

Stephen Harris lists at spuddy.org
Mon Mar 1 16:19:38 UTC 2010


On Mon, Mar 01, 2010 at 05:12:15PM +0100, Geoff Galitz wrote:

> I'd do it like this:
> 
> grep medintux /etc/group
> if [ $? != 0 ]; then
>   echo "Group not found"
> fi

Or allow for naming services (NIS, LDAP, whatever)

  if [ -z "$(getent group medintux)" ]
  then
    groupadd ....
  fi

-- 

rgds
Stephen



More information about the CentOS mailing list