LOGNAME(1) General Commands Manual LOGNAME(1)

lognamereturn user’s login name

logname

The logname utility shall write the user’s login name to standard output. The login name shall be the string that would be returned by the . 1 {8} () function. Under the conditions where the getlogin() function would fail, the logname utility shall write a diagnostic message to standard error and exit with a nonzero exit status.

None.

None.

None.

None.

The following environment variables shall affect the execution of logname:

This variable shall determine the locale to use for the locale categories when both LC_ALL and the corresponding environment variable (beginning with LC_ ) do not specify a locale. See 2.6.

This variable shall determine the locale to be used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_.

This variable shall determine the language in which messages should be written.

Default.

The logname utility output shall be a single line consisting of the user’s login name: "%s\n", <login name>

Used only for diagnostic messages.

None.

None.

The logname utility shall exit with one of the following values:

Successful completion.

An error occurred.

Default.

The logname utility explicitly ignores the environment variable because environment changes could produce erroneous results.

The passwd file is not listed as required, because the implementation may have other means of mapping login names.

September 1991 posix.fail