Well, since RPMs have to be installed by a privleged user, I'd say just grep
for the username in /etc/passwd.

I.e.
if [ -z `grep joefafanoush /etc/passed 2> /dev/null` ] ; then useradd -r
joefafanoush;
fi


----- Original Message -----
From: "Chad and Doria Skinner" <[EMAIL PROTECTED]>
To: "Redhat-List" <[EMAIL PROTECTED]>
Sent: Saturday, December 08, 2001 3:56 PM
Subject: testing for a user in a script?


> 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.)
>
> Thanks,
> Chad
>
>
>
> _______________________________________________
> Redhat-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-list
>



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

Reply via email to