On Wed, Dec 20, 2006 at 10:47:25PM -0800, John W. Krahn wrote:
> Mumia W. wrote:
> > On 12/20/2006 04:14 PM, Tom Smith wrote:
> >> [...]
> >> So is there a better way to do this, or perhaps a cleaner way?
> > 
> > use strict;
> > use warnings;
> > $_ = `id $ARGV[0]`;
> > s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n";
> 
> print $1 if `groups $ARGV[0] 2>/dev/null` =~ /$ARGV[0]\s*:\s*(.+)/;

According to the manpage for groups on FreeBSD Release 6.1, it's
deprecated in favor of the id utility -- and with the -Gn switches, it
works identically to the groups command.  Just thought I'd mention.

-- 
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
"The ability to quote is a serviceable
substitute for wit." - W. Somerset Maugham

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to