You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Stricter rules around setting environment variables [[toc](#table-of-content)]
97
+
98
+
::: warning Breaking change
99
+
See a full overview of the [breaking changes](#breaking-changes-toc)
100
+
:::
101
+
102
+
The setting of environment variables via the following ways:
103
+
-`$env.VAR_NAME = ...` assignment
104
+
- scopes with the `with-env` command
105
+
- the short hand syntax `FOO=bar command-to-run`
106
+
- the `load-env` command
107
+
108
+
will now consistently prohibit you from changing a set of special environment variables controlled by Nushell.
109
+
Currently this is the following set (already valid for `$env.` assignment):
110
+
-`$env.PWD`
111
+
-`$env.FILE_PWD`
112
+
-`$env.CURRENT_FILE`
113
+
This set may be expanded by future breaking changes to ensure consistent semantics of those special variables
114
+
115
+
Furthermore the `FOO=bar BAZ=bla command` shorthand syntax to set an environment variable for the scope of one command is now stricter.
116
+
It will disallow you from repeating the same environment variable name twice and instead return an error ([#12523](https://github.com/nushell/nushell/pull/12523)).
117
+
118
+
```nushell
119
+
# Now raises an error
120
+
FOO=bar FOO=bla command
121
+
```
122
+
123
+
Additionally, we standardize on using records to pass a map of environment variables to the `with-env` command, and thus [deprecate the other previously allowed forms with this release](#with-env-toc).
124
+
95
125
## Our set of commands is evolving [[toc](#table-of-content)]
0 commit comments