Previous | Table of Contents | Next |
DESCRIPTION
The external logname command displays your user name (login name ). logname returns the value of the environment variable $LOGNAME. The LOGNAME variable is set when you log in to the system.
The logname command can be used to perform testing in shell scripts. The user s login name can be checked for access permissions to a shell script. The logname output can be used for record keeping within a shell. It is not advisable to depend upon the output of logname for security reasons. The user can change the value of LOGNAME, thus changing the output of logname .
COMMAND FORMAT
Following is the general format of the logname command.
logname
RELATED COMMANDS
Refer to env and login described in modules 41 and 77.
RELATED FILES
The LOGNAME variable is set in /etc/profile file on some systems or by the login command on others. The logname command writes to the standard output.
APPLICATIONS
The logname command is used to return the user s login name. It may be used to log which users are using a certain shell script or to limit access to a shell script. If first names are used as login sequences the $LOGNAME variable may be used to personalize shell scripts.
TYPICAL OPERATION
In this activity you use the logname command to display your LOGNAME variable. Begin at the shell prompt.
cj> logname mylogin
Previous | Table of Contents | Next |