Docs: Document path vars more

Fixes #5741.

[ci skip]
This commit is contained in:
Fabian Homborg 2019-04-30 13:18:56 +02:00
parent 17116366dc
commit 05b2d4ee54
2 changed files with 4 additions and 1 deletions

View File

@ -40,6 +40,9 @@ The following options control variable scope:
- ``-u`` or ``--unexport`` causes the specified shell variable to NOT be exported to child processes - ``-u`` or ``--unexport`` causes the specified shell variable to NOT be exported to child processes
- ``--path`` causes the specified variable to be treated as a path variable, meaning it will automatically be split on colons, and joined using colons when quoted (`echo "$PATH"`) or exported.
- ``--unpath`` causes the specified variable to not be treated as a path variable. Variables with a name ending in "PATH" are automatically path variables, so this can be used to treat such a variable normally.
The following options are available: The following options are available:

View File

@ -288,7 +288,7 @@ Other variables, like ``$PATH``, really do have multiple values. During variable
/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/bin
Note that there are three environment variables that are automatically split on colons to become lists when fish starts running: ``PATH``, ``CDPATH``, ``MANPATH``. Conversely, they are joined on colons when exported to subcommands. All other environment variables (e.g., ``LD_LIBRARY_PATH``) which have similar semantics are treated as simple strings. Variables whose name ends in "PATH" are automatically split on colons to become lists. They are joined using colons when exported to subcommands. This is for compatibility with other tools, which expect $PATH to use colons. You can also explicitly add this quirk to a variable with `set --path`, or remove it with `set --unpath`.
Lists cannot contain other lists: there is no recursion. A variable is a list of strings, full stop. Lists cannot contain other lists: there is no recursion. A variable is a list of strings, full stop.