- return user's login name
logname writes the user's login name to standard output. The login name is the string that is returned by the getlogin(3C) function. If getlogin() does not return successfully, the name corresponding to the real user ID of the calling process is used instead.
See environ(5) for descriptions of the following environment variables that affect the execution of logname: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following error values are returned:
An error occurred.
Environment for user at login time
User and accounting information
See attributes(5) for descriptions of the following attributes: