(login) behaviour.
DAVID NEWALL
ccdn at levels.sait.edu.au
Wed May 24 03:22:02 AEST 1989
In article <BRISTER.89May17211626 at aries.td2cad.intel.com>, brister at td2cad.intel.com (James Brister) writes:
> Is this standard operating procedure for UN*X or just Ultrix 2.2? Basically,
> when running the command ``login'' in a subshell, the username of the original
> shell gets changed when the subshell exits.
The file "/etc/utmp" can be used to translate terminals into logged in
users. This file is updated by login. The "who" command uses this file
to display the appropriate information. The command "who am i" therefore
also uses this file.
What is happening when you call "login" in a subshell is this: the utmp
entry for your terminal is overwritten with the new username. When you
exit the subshell, the utmp entry still contains the "new" username.
If you are using a BSD flavour of Unix (and I suspect you are), you should
use the command "whoami". This command apparently does not use /etc/utmp.
David Newall Phone: +61 8 343 3160
Unix Systems Programmer Fax: +61 8 349 6939
Academic Computing Service E-mail: ccdn at levels.sait.oz.au
SA Institute of Technology Post: The Levels, South Australia, 5095
More information about the Comp.unix.wizards
mailing list