How to store username

I would like to write files to a directory (not under the user's home) which includes the userid.

Example:
userid = john
John's home dir is /home/john

I want to create a directory /var/prog/john

MSG_HOME=/var/prog; export MSG_HOME;
USR_NAME=@@@@; export USER_NAME;

if [ ! -d "$MSG_HOME/$USR_NAME" ];

then
mkdir $MSG_HOME/$USR_NAME || USAGE_EXIT "Unable to create " "$MSG_HOME/$USR_NAME "

fi

How do i define @@@@ ?

id -u -n will return john

but how do I get is assigned to USR_NAME?

USR_NAME=`uname -u -n`
is one way.

But type "env" and look at the environment variables that are set for you. Most versions of unix will set LOGNAME for you and you can use that.

The most of Unix shell set up variable LOGNAME or USER [or both]. If you would like to use exact command, use "whoami" ...

Thanks!

LOGNAME / $LOGNAME worked for me.

Unixware7