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
The order C P E L C N C F P N N P S X X was quite confusing.
While there is value in putting the config and PATH first, because they are common and important variables, the table of contents becomes very inconsistent and confusing when mixed like before.
Copy file name to clipboardExpand all lines: book/special_variables.md
+31-31Lines changed: 31 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -49,20 +49,32 @@ The `$nu` constant is a record containing several useful values:
49
49
50
50
There are also several environment variables that Nushell uses for specific purposes:
51
51
52
+
### `$env.CMD_DURATION_MS`
53
+
54
+
The amount of time in milliseconds that the previous command took to run.
55
+
52
56
### `$env.config`
53
57
54
58
`$env.config` is the main configuration record used in Nushell. Settings are documented in `config nu --doc`.
55
59
56
-
### `$env.PATH`
57
-
58
-
The search path for executing other applications. It is initially inherited from the parent process as a string, but converted to a Nushell `list` at startup for easy access.
60
+
### `$env.CURRENT_FILE`
59
61
60
-
It is converted back to a string before running a child-process.
62
+
Inside a script, module, or sourced-file, this variable holds the fully-qualified filename. Note that this
63
+
information is also available as a constant through the [`path self`](/commands/docs/path_self.md) command.
61
64
62
65
### `$env.ENV_CONVERSIONS`
63
66
64
67
Allows users to specify how to convert certain environment variables to Nushell types. See [ENV_CONVERSIONS](./configuration.md#env-conversions).
65
68
69
+
### `$env.FILE_PWD`
70
+
71
+
Inside a script, module, or sourced-file, this variable holds the fully qualified name of the directory in which
72
+
the file resides. Note that this value is also available as a constant through:
73
+
74
+
```nu
75
+
path self | path dirname
76
+
```
77
+
66
78
### `$env.LAST_EXIT_CODE`
67
79
68
80
The exit code of the last command, usually used for external commands — Equivalent to `$?` from POSIX. Note that this information is also made available to the `catch` block in a `try` expression for external commands. For instance:
@@ -81,27 +93,29 @@ try {
81
93
# => 2
82
94
```
83
95
84
-
### `$env.CMD_DURATION_MS`
96
+
### `$env.NU_LIB_DIRS`
85
97
86
-
The amount of time in milliseconds that the previous command took to run.
98
+
A list of directories which will be searched when using the `source`, `use`, or `overlay use` commands. See also:
Inside a script, module, or sourced-file, this variable holds the fully qualified name of the directory in which
100
-
the file resides. Note that this value is also available as a constant through:
112
+
The current Nushell version. The same as `(version).version`, but, as an environment variable, it is exported to and can be read by child processes.
101
113
102
-
```nu
103
-
path self | path dirname
104
-
```
114
+
### `$env.PATH`
115
+
116
+
The search path for executing other applications. It is initially inherited from the parent process as a string, but converted to a Nushell `list` at startup for easy access.
117
+
118
+
It is converted back to a string before running a child-process.
105
119
106
120
### `$env.PROCESS_PATH`
107
121
@@ -110,20 +124,6 @@ above, it is not present when sourcing a file or importing a module.
110
124
111
125
Note: Also unlike the two variables above, the exact path (including symlinks) that was used to _invoke_ the file is returned.
112
126
113
-
### `$env.NU_LIB_DIRS`
114
-
115
-
A list of directories which will be searched when using the `source`, `use`, or `overlay use` commands. See also:
0 commit comments