-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jeremy C. Reed wrote:

>> How do I verify if a user already exists?  
>> 
>> I have this, but it gives me unary error when the user doesn't exist
>> because it doens't output a numeric value.
>
>> var2=`/usr/bin/id -u $var1`
>
>Check the exit status here.
>
> if [ $? -eq 1 ]; then # Does not exist ...

That's an unnecessary extra step.  This will do:

$ var=`id -u pepe` || echo "Sorry."

- -d


- -- 
David Talkington
http://www.spotnet.org

PGP key: http://www.prairienet.org/~dtalk/0xCA4C11AD.pgp

-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
Comment: Made with pgp4pine 1.75-6

iQA/AwUBPBfvHb9BpdPKTBGtEQJnzgCcDnCR4ZZEknE1TRmhfZlPoPPOBzcAoPge
GT2iMfY37JbYVB53pBqywJQO
=o4NJ
-----END PGP SIGNATURE-----




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

Reply via email to