bcrowell2 has asked for the wisdom of the Perl Monks concerning the following question:
I find that getlogin(), which has always worked for me on past versions of debian, doesn't work on ubuntu precise. Is this a bug? A feature?
Here was the best workaround I was able to find:
my $user = getlogin() || `whoami`; $user =~ s/\n$//;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: getlogin works on debian but not ubuntu?
by LanX (Saint) on Jan 07, 2013 at 00:57 UTC | |
by bcrowell2 (Friar) on Jan 07, 2013 at 01:33 UTC | |
by LanX (Saint) on Jan 07, 2013 at 01:46 UTC | |
by bcrowell2 (Friar) on Jan 07, 2013 at 01:51 UTC | |
by mbethke (Hermit) on Jan 07, 2013 at 04:04 UTC | |
|