i3buntu
i3buntu copied to clipboard
Whoami returns root when invoked from script started with sudo
When script s started with sudo, whoami returns root instead of the username of calling user. Replace with logname for the last two lines to work correctly.
I have tried to update the README to solve the issue. Can you test it?
Yes, this does work. But you can simply replace $(whoami) with $(logname) to achieve the desired effect. You can test that by running following commands sudo sh -c 'echo $(whoami)' - that will return root sudo sh -c 'echo $(logname)' - that will return the correct username