Is there a way to assert the current "user" is root (i.e. the script was run by root) using the fish shell?
I know for bash you can check the EUID
Is there a way to assert the current "user" is root (i.e. the script was run by root) using the fish shell?
I know for bash you can check the EUID
Can't do it with just fish. I'd write:
if test (id -u) -eq 0
echo root
else
echo not root
end
id
command will report the current effective or real UID. And since such checks are rare and not performance critical there is no reason to implement it as a builtin command or variable.
Commented
Jan 28, 2017 at 3:10