[xubuntu-users] Detecting login name after su

Joshua O'Leary jmoey139 at gmail.com
Tue Oct 8 20:16:50 UTC 2013


You could use pipes or create a temporary file. Or instead of running 
sudo su -, simply prefix every command in the script with 'sudo'. 
Passing the username as an option would work in this instance as 
anything in `` is evaluated first.
On 05/10/13 21:39, Peter Flynn wrote:
> On 10/05/2013 05:14 PM, Joshua O'Leary wrote:
>> You could pass the username as a parameter to the script at runtime:
>> myscript.sh `whoami`
> But the script is being run automatically as root, after sudo su -, so
> whoami would always return root.
>
> ///Peter
>
>





More information about the xubuntu-users mailing list