site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=U9Syqga9iWdKpcA8ie1S57rNe1vMiy2fPpPlwyMY2CbH8Zt9ioZtamZ4kdH9NY1xrrFhDl2QZ4khoJ3XpJx5rU2Xnh0OyRP/DNr5yYi+GXeDuXbDDZZckU82obQICgbZzXY7CF9uEPOq07wcWeUudP/2e5evR0c8H1fn5piikK4= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=CSCPij4fIueK8IIDUEm6qP+kaxjuiEaVFboKQ/g5eTzXcgxbXHM9BHs8UAz6QlfZ43eFflbgIdGRk2zZpZu5p7SDQ7G2MK+f797iCazp5MxCiM5xC+VKs/XioHmviGLJGndp0PtfLP+VtxixhdnwJEDENgQ5dydvZ5vo88r+p1A= On 30/08/2007, Mike <lists@michael-amorose.com> wrote:
I have a shell script that needs to get the LOGNAME env variable. But I need to run my script using sudo which apparently causes LOGNAME to incorrectly be set to "root".
How can can I get the logged in user's name even when running a script using sudo?
I need to get the user name because I need to build shell path to the current user's desktop and only the exact logged in user's name will work.
From sudo(8):
ENVIRONMENT ... SUDO_USER Set to the login of the user who invoked sudo -- James Peach | jorgar@gmail.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com