mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-07 23:41:15 -03:00
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
This commit is contained in:
committed by
Fabian Homborg
parent
de9e8cb897
commit
e2f03fa8a7
31
doc_src/cmds/fish_is_root_user.rst
Normal file
31
doc_src/cmds/fish_is_root_user.rst
Normal file
@@ -0,0 +1,31 @@
|
||||
.. _cmd-fg:
|
||||
|
||||
fish_is_root_user - check if the current user is root
|
||||
=====================================================
|
||||
|
||||
Synopsis
|
||||
--------
|
||||
|
||||
::
|
||||
|
||||
fish_is_root_user
|
||||
|
||||
Description
|
||||
-----------
|
||||
|
||||
``fish_is_root_user`` will check if the current user is root. It can be useful
|
||||
for the prompt to display something different if the user is root, for example.
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
A simple example:
|
||||
|
||||
::
|
||||
|
||||
function example --description 'Just an example'
|
||||
if fish_is_root_user
|
||||
do_something_different
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user