W3cubDocs

/Nushell

is-admin for core

Check if nushell is running with administrator or root privileges.

Signature

> is-admin {flags}

Input/output types:

input output
nothing bool

Examples

Return 'iamroot' if nushell is running with admin/root privileges, and 'iamnotroot' if not.

>if (is-admin) { "iamroot" } else { "iamnotroot" }
iamnotroot

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/is-admin.html