If I create the script /root/bin/whoami.sh containing:
/root/bin/whoami.sh
#!/bin/bash whoami
and this script is called by a user with a properly
Using whoami, who am i, who, id or $SUDO_USER isn't right here.
whoami
who am i
who
id
$SUDO_USER
Actually, who is never a solution to the question, as it will only list the logged in users, which might be dozens...
In my eyes, the only valuable answer is the use of logname.
logname
Hope this helps
Rob