File: fish_is_root_user.fish

package info (click to toggle)
fish 4.2.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 35,980 kB
  • sloc: python: 6,972; javascript: 1,407; sh: 1,009; xml: 411; ansic: 230; objc: 78; makefile: 20
file content (14 lines) | stat: -rw-r--r-- 328 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 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 test "$EUID" = 0 2>/dev/null
        return 0
    end

    if contains -- $USER root toor Administrator
        return 0
    end

    return 1
end