[CentOS] Slightly OT: check creation of a group
reloftin at twcny.rr.com
Mon Mar 1 16:07:12 UTC 2010
On Mon, 2010-03-01 at 17:03 +0100, Niki Kovacs wrote:
> I'm currently writing an install script for an application, and my
> already limited Bash skills are a bit rusty.
> I want to check if a group exists, and if it doesn't, then create it.
> Only thing I found is:
> if [ grep medintux /etc/group ]; then
> groupadd medintux
> Apparently I can't seem to "negate" the test, e. g. something like
> if !(grep medintux /etc/group)
> Any suggestions for the correct syntax here ?
grep -q medintux /etc/group || groupadd medintux
> CentOS mailing list
> CentOS at centos.org
Ron Loftin reloftin at twcny.rr.com
"God, root, what is difference ?" Piter from UserFriendly
More information about the CentOS