I got a script requiring sudo, but the script must set parameters according to the original user, such as:
chown "${USER}:${USER}" dir
If I set it under sudo, I just end up with chmod root:root
, which doesn't help.
So how can I get the user name before sudo?