docs: Rewrite identifiers and move it down

Weird to mention it before even explaining variables.
This commit is contained in:
Fabian Homborg 2020-05-24 10:33:46 +02:00
parent 65dde5b55a
commit 87660d3d87

View file

@ -810,19 +810,6 @@ Example:
If the current directory contains the files 'foo' and 'bar', the command ``echo a(ls){1,2,3}`` will output ``abar1 abar2 abar3 afoo1 afoo2 afoo3``.
.. _identifiers:
Shell variable and function names
---------------------------------
The names given to shell objects like variables and function names are known as "identifiers". Each type of identifier has rules that define what sequences of characters are valid to use.
A variable name cannot be empty. It can contain only letters, digits, and underscores. It may begin and end with any of those characters.
A function name cannot be empty. It may not begin with a hyphen ("-") and may not contain a slash ("/"). All other characters, including a space, are valid.
A bind mode name (e.g., ``bind -m abc ...``) is restricted to the rules for valid variable names.
.. _variables:
Shell variables
@ -1298,6 +1285,21 @@ Many other shells have a large library of builtin commands. Most of these comman
For a list of all builtins, functions and commands shipped with fish, see the :ref:`list of commands <Commands>`. The documentation is also available by using the ``--help`` switch of the command.
.. _identifiers:
Shell variable and function names
---------------------------------
The names given to variables and functions (so called "identifiers") have to follow certain rules:
- A variable name cannot be empty. It can contain only letters, digits, and underscores. It may begin and end with any of those characters.
- A function name cannot be empty. It may not begin with a hyphen ("-") and may not contain a slash ("/"). All other characters, including a space, are valid.
- A bind mode name (e.g., ``bind -m abc ...``) is restricted to the rules for valid variable names.
Other things have other restrictions. For instance what is allowed for file names depends on your system, but at the very least they cannot contain a "/" (because that is the path separator) or NULL byte (because that is how UNIX ends strings).
Interactive use
===============