mirror of
https://github.com/nushell/nushell.git
synced 2024-11-26 10:23:52 +01:00
c0a1d18e3d
* feat: update #4455, regenerate commands' docs * chore: update make_docs script
679 B
679 B
title | layout | version |
---|---|---|
with-env | command | 0.59.0 |
Runs a block with an environment variable set.
Signature
> with-env (variable) (block)
Parameters
variable
: the environment variable to temporarily setblock
: the block to run once the variable is set
Examples
Set the MYENV environment variable
> with-env [MYENV "my env value"] { $env.MYENV }
Set by primitive value list
> with-env [X Y W Z] { $env.X }
Set by single row table
> with-env [[X W]; [Y Z]] { $env.W }
Set by row(e.g. open x.json
or from json
)
> echo '{"X":"Y","W":"Z"}'|from json|with-env $in { echo $env.X $env.W }