$LOGNAME
 – 
Current login name
$LOGNAME contains the login name of the current login session.
If $LOGNAME is not set in the environment of the shell, it’s initialized to the string returned by the getlogin(3) system call if available.
Links
BashSupport Pro 是一款支持 logname** 的 **Zsh 集成开发环境 - 立即试用!