Path: utzoo!utgpu!watmath!clyde!att!rutgers!rochester!uhura.cc.rochester.edu!sunybcs!bingvaxu!leah!itsgw!steinmetz!uunet!ispi!tfli!mikej
From: mikej@tfli.UUCP (Michael R.  Johnston)
Newsgroups: comp.unix.xenix
Subject: Re: Finding the user name via the shell
Keywords: shell variables
Message-ID: <249@tfli.UUCP>
Date: 3 Dec 88 14:42:16 GMT
References: <6323@polyslo.CalPoly.EDU>
Reply-To: mikej@tfli.UUCP (Michael R.  Johnston)
Organization: Tempforce Long Island, NY
Lines: 18

In article <6323@polyslo.CalPoly.EDU> mdella@polyslo.CalPoly.EDU (Marcos R. Della) writes:
>I was wondering if anyone out there knew how to determine the users
>login name while running a shell script. I can get the home address
>$HOME, but not the name. This is under sco xenix 2.2.3 I think...

The correct answer is to use the variable $LOGNAME. That will return the users
login name. The users REAL NAME is a different story. That could be done as
follows:

REALNAME=`grep "^$LOGNAME:" /etc/password|cut -d: -f5`

Thats all folks!


-- 
---
                Michael R. Johnston - @NET: mikej@cpmain.uucp
...{cmcl2!phri!,uunet!}dasys1!cpmain!mikej || ...!philabs!mergvax!cpmain!mikej