> 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
Sherm Pendley - 06 Jan 2006 00:52 GMT
> If you need more than the numeric user ID, have a look at:
>
> perldoc getpwnam
> perldoc User::pwent
D'oh! getpwnam() is a function (not a module), so that should be:
perldoc -f getpwnam
perldoc User::pwent
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
James Reynolds - 06 Jan 2006 17:04 GMT
Thanks everyone! I suppose I should learn all the special variables
after all...
James
>>If you need more than the numeric user ID, have a look at:
>>
[quoted text clipped - 10 lines]
>Cocoa programming in Perl: http://camelbones.sourceforge.net
>Hire me! My resume: http://www.dot-app.org