On Jan 5, 2006, at 5:53 PM, James Reynolds wrote:

I know I can get this with `whoami`, but I was wondering if there was a "Perl" way to find the user who executed the script. I basically want to make it so my script is executable by normal users, but prints an error if it is not only the root user.

The $< variable has the real user id, and $> is the effective user id.

If you need more than the numeric user ID, have a look at:

        perldoc getpwnam
        perldoc User::pwent

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

Reply via email to