fish-shell/share/functions/fish_is_root_user.fish
Daniel Bengtsson e2f03fa8a7 Add a function to check if the user is root.
Add a helper function to check if the user is root. This function can be
useful for the prompts for example. Modify the prompts made root checked
to use the function instead. Add also the support of Administrator like
a root user.

Fixes: #7031
2020-06-26 21:25:13 +02:00

11 lines
266 B
Fish

# To know if the user is root. Used by several prompts to display something
# else if the user is root.
function fish_is_root_user --description "Check if the user is root"
if contains -- $USER root toor Administrator
return 0
end
return 1
end