Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

owner of a file

by Sara (Acolyte)
on Aug 15, 2002 at 14:59 UTC ( #190421=perlquestion: print w/replies, xml ) Need Help??

Sara has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: owner of a file
by tommyw (Hermit) on Aug 15, 2002 at 15:04 UTC

    perldoc -f -X returns...
    -o File is owned by effective uid
    -O File is owned by real uid.

    Too stupid to live.
    Too stubborn to die.

      -O is a file test operator -- it will return either a 1 or "" (or undefined if the file doesn't exist), not the actual UID.

      /me is far too hasty. tommyw is right, this does suit the original question.

      -- grummerX

        What? You mean like the original question asked?

        Too stupid to live.
        Too stubborn to die.

Re: owner of a file
by hacker (Priest) on Aug 15, 2002 at 15:05 UTC
    Something like:
    use strict; use File::stat; my $file = $0; my ($st, $uid, $gid); if (($st = stat ($file))) { $uid = $st->uid; $gid = $st->gid; print "Owner = $uid, Group = $gid, File = $file\n"; } else { print "Errors were found on $file\n"; }

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://190421]
Approved by Courage
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-01-16 18:38 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (49 votes). Check out past polls.