<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
You could pass the username as a parameter to the script at runtime:<br>
myscript.sh `whoami`<br>
<br>
Accessing it with the $1 (or whatever number the parameter is) in
the script.<br>
'logname' may also be an option but I think it needs to be running
in a tty/vt to work.<br>
<br>
Joshua<br>
<br>
<div class="moz-cite-prefix">On 04/10/13 08:34, Jan Henke wrote:<br>
</div>
<blockquote cite="mid:524E6F89.7090702@taujhe.de" type="cite">
<pre wrap="">Hi,
the command 'w' lists all currently logged in users together with the
source of the login. You can parse that output to look for you local
machine (IP address or reverse DNS name), then you have the user name.
Regards
Jan
Am 04.10.2013 00:57, schrieb Peter Flynn:
</pre>
<blockquote type="cite">
<pre wrap="">On 10/03/2013 08:58 PM, Lutz Andersohn wrote:
</pre>
<blockquote type="cite">
<pre wrap="">I think the users command always prints the original user. I logged on as some
user, did a sudo -i, called users again and it gave me my original user name.
also works with sudo su -
</pre>
</blockquote>
<pre wrap="">Indeed it does, thanks. But with potentially many users logged in, how
do I detect which one is the account I "came from"?
///Peter
</pre>
</blockquote>
<pre wrap="">
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>