On Sat, 2001-12-08 at 16:56, Chad and Doria Skinner wrote: > I am trying to create a SPEC file for a server and need to add a user for > the server to run under. I know I can do "useradd -r <username>" and create > the user, how would I test to make sure this user does not exist before I > create it. Or, does it even matter since useradd won't add to users with the > same username? (Seems like it would be better to test for the name first.)
Since you'll have a group and user equal on a Red Hat system, you can check for both at the same time: if grep ^$NEWUSER:x /etc/group >/dev/null then echo -e "\aERROR: user or group $NEWUSER already in use!!!" exit 1 fi -- Ed Wilts, Mounds View, MN, USA mailto:[EMAIL PROTECTED] _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list