is-admin

For core.

Check if nushell is running with administrator or root privileges.

Command Type

built-in

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

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.