base-files: LOGNAME

Andy Koppe andy.koppe@gmail.com
Mon May 31 11:56:00 GMT 2010


On 31 May 2010 09:18, Corinna Vinschen wrote:
> On May 30 10:02, Andy Koppe wrote:
>> On Sunday, May 30, 2010, Yaakov wrote:
>> > POSIX.1[1] describes a LOGNAME environment variable which represents the user's login name.  Adding the following lines to /etc/profile should do the trick:
>> >
>> > LOGNAME="`logname`"
>> > export LOGNAME
>> >
>> > Where logname(1) is a program supplied by coreutils whose presence is required by POSIX.1[2].
>>
>> That would mean a costly fork() during shell startup. Could this be
>> set in the DLL instead, as happens with the SHELL variable?
>
> Huh?  The Cygwin DLL does not set $SHELL.

You're right of course, it's actually bash that sets it. Seems I
confused myself quite thoroughly when I looked into this a few weeks
ago.

Anyway, so we've got USERNAME, USER, and LOGNAME. Does anyone know
what the differences between those are supposed to be? Apparently
USERNAME is set automatically on NT systems, so could /etc/profile
just copy that to USER and LOGNAME instead of invoking 'id' and
'logname'?

Posix defines LOGNAME, but regarding USER it only says that it is
"unwise to conflict with certain variables that are frequently
exported by widely used command interpreters and applications".
(http://opengroup.org/onlinepubs/007908799/xbd/envvar.html)

Andy

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list