Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

owner of a file

by Sara (Acolyte)
on Aug 15, 2002 at 14:59 UTC ( [id://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.

    --
    Tommy
    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.

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

      -- grummerX

        What? You mean like the original question asked?

        --
        Tommy
        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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-18 16:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found