Logo
Explore Help
Sign In
h/fish-shell
1
Fork 0
You've already forked fish-shell
mirror of https://github.com/fish-shell/fish-shell.git synced 2026-05-01 10:11:14 -03:00
Code Issues Packages Projects Releases Wiki Activity
Files
019a082d5d727faaa50b1dd4e33dfb6b271e4c7d
fish-shell/share/functions/fish_is_root_user.fish

15 lines
328 B
Fish
Raw Normal View History

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-17 17:55:23 +02:00
# 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"
Add $EUID and use it in fish_is_root_user Fixes #8866
2022-04-15 15:57:57 +02:00
if test "$EUID" = 0 2>/dev/null
return 0
end
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-17 17:55:23 +02:00
if contains -- $USER root toor Administrator
return 0
end
return 1
end
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.3 Page: 103ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API