[TAG] 2-cent Tip: Perl Search Directory Function
René Pfeiffer
lynx at luchs.at
Wed Jun 11 14:33:36 MSD 2008
On Jun 10, 2008 at 1938 -0400, Ben Okopnik appeared and said:
> On Tue, Jun 10, 2008 at 09:23:19PM +0200, Ren? Pfeiffer wrote:
> > [...]
> > Reading manuals costs too much time! ;)
>
> That's one of the reasons for using 'strict' and 'warnings'. You don't
> have to read anything - they'll just scream at you if you do it wrong.
> :)
That's why I love to talk to GCC and Intel's CC; they tell long stories
at times. :)
> > [...]
> > I have to try that. I basically want to do a very simple thing: create
> > lists of places where group A or user B has access to.
>
> If I understand what you're saying, that would be something like
>
> ```
> $gid > $uid >
> # Get the perms, owner, and group of the file
> ($mode, $owner, $group) > or die "Stat failed: $!\n";
> # Mask off the filetype/convert to octal
> $mode > '''
>
> Hopefully, the rest is obvious.
Yes, it is, thanks. The problem I had yesterday was to make the code
that find2perl spits out get to work. "find2perl /tmp -perm 0220 -user
lynx" produces code where a hash of all uid/user mappings is created
first.
my (%uid, %user);
while (my ($name, $pw, $uid) $uid{$name} }
And believe it or not, this wasn't working as expected yesterday (or I
was really tired). The "($uid = $uid{'lynx'})" part failed. Too bad the
code I fiddled with is on my machine at home. I'll try again now with a
different code, let's see.
Best,
Ren?.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.linuxgazette.net/mailman/private/tag/attachments/20080611/88d722aa/attachment.pgp
More information about the TAG
mailing list