On Sat, Dec 08, 2001 at 04:56:15PM -0600, Chad and Doria Skinner <[EMAIL PROTECTED]> 
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.)

user=fred
if grep "^$user:" /etc/passwd >/dev/null
then
    echo "Whoa! $user exists!"
fi

-- 
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

I die. Before I die my body turns hair-side-in. People come from everywhere to
see the insides of themselves. But the sight makes them lose the will, and all
die. O the embarrassment.       - Joe Haldeman, _A !Tangled Web_



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to