Re: How to return user name in a script even if run by SUDO?
- From: Sundar Nagarajan <sundar.personal@xxxxxxxxx>
- Date: Tue, 07 Apr 2009 22:51:55 -0700
kapil singh kushwah wrote:
Hello ,
It is working fine. I guess you did it
after login as a root.
I am getting :
common@common-laptop:~$ echo ${USER}
common
common@common-laptop:~$ sudo echo ${USER}
common
common@common-laptop:~$
Thanks
Kapil Singh Kushwah
System/Network Administrator
Hotwax Media Inc.
sudo echo ${USER} will cause top level shell to expand ${USER} - i.e.
_BEFORE_ executing sudo. Hence you will see the same value with and
without sudo
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
- References:
- How to return user name in a script even if run by SUDO?
- From: Arch Willingham
- Re: How to return user name in a script even if run by SUDO?
- From: kapil singh kushwah
- How to return user name in a script even if run by SUDO?
- Prev by Date: Re: New to ubuntu
- Next by Date: Re: How to return user name in a script even if run by SUDO?
- Previous by thread: Re: How to return user name in a script even if run by SUDO?
- Next by thread: Re: How to return user name in a script even if run by SUDO?
- Index(es):
Relevant Pages
|