For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > December 2006 > [Fwd: Re: Displaying a user's group memberships]









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [Fwd: Re: Displaying a user's group memberships]
Tom Smith

2006-12-21, 6:59 pm

Sorry, I sent this to the poster rather than the list... My bad.

-------- Original Message --------
Subject: Re: Displaying a user's group memberships
Date: Wed, 20 Dec 2006 20:39:13 -0700
From: Tom Smith <tom71713-perl@inqone.com>
To: John W. Krahn <krahnj@telus.net>
References: <45872961.7080805@inqone.com>
<20061219001601.GA32475@apotheon.com> <4589B5BA.7060907@inqone.com>
<4589E34E.60908@telus.net>



John W. Krahn wrote:
> Tom Smith wrote:
>
>
> Say that you have two users 'ron' and 'ronald'. If $ARGV[0] contains 'ron'
> then this will get you the group names for *both* 'ron' *and* 'ronald' (and
> any other group names where the string 'ron' is found.)
>


Sorry, couldn't help myself... Had to check in to it tonight. :-D Here's
what seems to work in the Rx Toolkit...

[:,]$ARGV[0][,\s]

So we basically just check for a ":" or "," before the username and a
"," or " " (space) after the username. This should prevent matching
"ron" in "ronald", as in your example. I tested it on a few other
similar names and had the same results--only the complete username was
matched.

I haven't tested it in the program yet, but my tests in Rx Toolkit
provide the expected results. I'll try it in the script tomorrow and see
how it goes.

Thanks again for the great advice!

~ Tom.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com