export-env

For env.

Run a block and preserve its environment in a current scope.

Command Type

keyword

Signature

> export-env {flags} (block)

Parameters

  • block: The block to run to set the environment.

Input/output types:

input output
nothing nothing

Examples

Set an environment variable.

> export-env { $env.SPAM = 'eggs' }

Set an environment variable and examine its value.

> export-env { $env.SPAM = 'eggs' }; $env.SPAM
eggs

Notes

This command is a parser keyword. For details, check: https://www.nushell.sh/book/thinking_in_nu.html

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