From 05b2d4ee5491700e00fdf96e23edbb846c5f6c30 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Tue, 30 Apr 2019 13:18:56 +0200 Subject: [PATCH] Docs: Document path vars more Fixes #5741. [ci skip] --- sphinx_doc_src/cmds/set.rst | 3 +++ sphinx_doc_src/tutorial.rst | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sphinx_doc_src/cmds/set.rst b/sphinx_doc_src/cmds/set.rst index df051318c..405485924 100644 --- a/sphinx_doc_src/cmds/set.rst +++ b/sphinx_doc_src/cmds/set.rst @@ -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 +- ``--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: diff --git a/sphinx_doc_src/tutorial.rst b/sphinx_doc_src/tutorial.rst index 7cdbf436c..668e4b195 100644 --- a/sphinx_doc_src/tutorial.rst +++ b/sphinx_doc_src/tutorial.rst @@ -288,7 +288,7 @@ Other variables, like ``$PATH``, really do have multiple values. During variable /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.