How can I check whether a user is root or not within a BASH script?
I know I can use
[[ $UID -eq 0 ]] || echo "Not root"
or
[[ $EUID -eq 0 ]] || echo "Not root"
but if the script was invoked via fakeroot, UID and EUID are both 0 (of course, as fakeroot fakes root privileges).
But is there any way to check whether the user is root? Without trying to do something only root can do (i.e. creating a file in /)?