How to return user name in a script even if run by SUDO?
arch at tuparks.com
Tue Apr 7 00:57:58 UTC 2009
How do I return the name of the user in a script even if it is fired off by SUDO? In other words, if my script has these two lines:
If I run it normally when logged in a user named wareagle, it prints out:
But if I run it via sudo, it prints out:
I need to be able to know the name of the currently logged in user even if the script is run by sudo?
More information about the ubuntu-users