I just learned yesterday about the getlogin function built into Perl, which works under both, Unix and Windows:
Implements the C library function of the same name, which on most systems returns the current login from /etc/utmp, if any. If null, use "getpwuid".
$login = getlogin || getpwuid($<) || "Kilroy";
Do not consider "getlogin" for authentication: it is not as secure as "getpwuid".
So the above code should be used instead of what you have now.
In reply to Re: How do you grab username/login id in Unix?
by Corion
in thread How do you grab username/login id in Unix?
by jeremyw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |