Module 78 logname (SV)

Previous Table of Contents Next


Module 78
logname (SV)

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.

1.    Type logname and press Return to display the value of your LOGNAME variable.
 cj> logname      mylogin 
2.     Turn to Module 159 to continue the learning sequence.


Previous Table of Contents Next

Copyright Wordware Publishing, Inc.


Illustrated UNIX System V
Illustrated Unix System V/Bsd
ISBN: 1556221878
EAN: 2147483647
Year: N/A
Pages: 144
Authors: Robert Felps

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net