diff --git a/sphinx_doc_src/cmds/count.rst b/sphinx_doc_src/cmds/count.rst index 566c140b0..150700313 100644 --- a/sphinx_doc_src/cmds/count.rst +++ b/sphinx_doc_src/cmds/count.rst @@ -1,6 +1,6 @@ .. _cmd-count: -count - count the number of elements of an array +count - count the number of elements of a list ================================================ Synopsis @@ -14,7 +14,7 @@ count < FILE Description ----------- -``count`` prints the number of arguments that were passed to it, plus the number of newlines passed to it via stdin. This is usually used to find out how many elements an environment variable array contains, or how many lines there are in a text file. +``count`` prints the number of arguments that were passed to it, plus the number of newlines passed to it via stdin. This is usually used to find out how many elements an environment variable list contains, or how many lines there are in a text file. ``count`` does not accept any options, not even ``-h`` or ``--help``. diff --git a/sphinx_doc_src/cmds/function.rst b/sphinx_doc_src/cmds/function.rst index b7480331b..2cf00e57c 100644 --- a/sphinx_doc_src/cmds/function.rst +++ b/sphinx_doc_src/cmds/function.rst @@ -41,7 +41,7 @@ The following options are available: - ``-V`` or ``--inherit-variable NAME`` snapshots the value of the variable ``NAME`` and defines a local variable with that same name and value when the function is defined. This is similar to a closure in other languages like Python but a bit different. Note the word "snapshot" in the first sentence. If you change the value of the variable after defining the function, even if you do so in the same scope (typically another function) the new value will not be used by the function you just created using this option. See the ``function notify`` example below for how this might be used. -If the user enters any additional arguments after the function, they are inserted into the environment `variable array `__ ``$argv``. If the ``--argument-names`` option is provided, the arguments are also assigned to names specified in that option. +If the user enters any additional arguments after the function, they are inserted into the environment `variable list `__ ``$argv``. If the ``--argument-names`` option is provided, the arguments are also assigned to names specified in that option. By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the :ref:`emit ` builtin. Fish generates the following named events: diff --git a/sphinx_doc_src/cmds/help.rst b/sphinx_doc_src/cmds/help.rst index 24ea5b75d..c9f55ad06 100644 --- a/sphinx_doc_src/cmds/help.rst +++ b/sphinx_doc_src/cmds/help.rst @@ -18,7 +18,7 @@ If a ``SECTION`` is specified, the help for that command is shown. If the BROWSER environment variable is set, it will be used to display the documentation. Otherwise, fish will search for a suitable browser. -If you prefer to use a different browser (other than as described above) for fish help, you can set the fish_help_browser variable. This variable may be set as an array, where the first element is the browser command and the rest are browser options. +If you prefer to use a different browser (other than as described above) for fish help, you can set the fish_help_browser variable. This variable may be set as a list, where the first element is the browser command and the rest are browser options. Note that most builtin commands display their help in the terminal when given the ``--help`` option. diff --git a/sphinx_doc_src/cmds/read.rst b/sphinx_doc_src/cmds/read.rst index 8b8d0fee2..d4f77b94d 100644 --- a/sphinx_doc_src/cmds/read.rst +++ b/sphinx_doc_src/cmds/read.rst @@ -43,7 +43,7 @@ The following options are available: - ``-x`` or ``--export`` exports the variables to child processes. -- ``-a`` or ``--array`` stores the result as an array in a single variable. +- ``-a`` or ``--array`` stores the result as a list in a single variable. - ``-z`` or ``--null`` marks the end of the line with the NUL character, instead of newline. This also disables interactive mode. @@ -62,7 +62,7 @@ If no variable names are provided, ``read`` enters a special case that simply pr When running in this mode, ``read`` does not split the input in any way and text is redirected to standard output without any further processing or manipulation. -If ``-a`` or ``--array`` is provided, only one variable name is allowed and the tokens are stored as an array in this variable. +If ``-a`` or ``--array`` is provided, only one variable name is allowed and the tokens are stored as a list in this variable. See the documentation for ``set`` for more details on the scoping rules for variables. diff --git a/sphinx_doc_src/cmds/set.rst b/sphinx_doc_src/cmds/set.rst index 405485924..1687c9e07 100644 --- a/sphinx_doc_src/cmds/set.rst +++ b/sphinx_doc_src/cmds/set.rst @@ -57,9 +57,9 @@ The following options are available: - ``-L`` or ``--long`` do not abbreviate long values when printing set variables -If a variable is set to more than one value, the variable will be an array with the specified elements. If a variable is set to zero elements, it will become an array with zero elements. +If a variable is set to more than one value, the variable will be a list with the specified elements. If a variable is set to zero elements, it will become a list with zero elements. -If the variable name is one or more array elements, such as ``PATH[1 3 7]``, only those array elements specified will be changed. If you specify a negative index when expanding or assigning to an array variable, the index will be calculated from the end of the array. For example, the index -1 means the last index of an array. +If the variable name is one or more list elements, such as ``PATH[1 3 7]``, only those list elements specified will be changed. If you specify a negative index when expanding or assigning to a list variable, the index will be calculated from the end of the list. For example, the index -1 means the last index of a list. The scoping rules when creating or updating a variable are: @@ -81,7 +81,7 @@ The exporting rules when creating or updating a variable are identical to the sc In query mode, the scope to be examined can be specified. -In erase mode, if variable indices are specified, only the specified slices of the array variable will be erased. +In erase mode, if variable indices are specified, only the specified slices of the list variable will be erased. ``set`` requires all options to come before any other arguments. For example, ``set flags -l`` will have the effect of setting the value of the variable ``flags`` to '-l', not making the variable local. @@ -110,7 +110,7 @@ Examples # Removes the variable $smurf set -e smurf - # Changes the fourth element of the $PATH array to ~/bin + # Changes the fourth element of the $PATH list to ~/bin set PATH[4] ~/bin # Outputs the path to Python if ``type -p`` returns true. diff --git a/sphinx_doc_src/cmds/vared.rst b/sphinx_doc_src/cmds/vared.rst index aec694ab6..b5caca6d0 100644 --- a/sphinx_doc_src/cmds/vared.rst +++ b/sphinx_doc_src/cmds/vared.rst @@ -12,10 +12,10 @@ vared VARIABLE_NAME Description ----------- -``vared`` is used to interactively edit the value of an environment variable. Array variables as a whole can not be edited using ``vared``, but individual array elements can. +``vared`` is used to interactively edit the value of an environment variable. Array variables as a whole can not be edited using ``vared``, but individual list elements can. Example ------- -``vared PATH[3]`` edits the third element of the PATH array +``vared PATH[3]`` edits the third element of the PATH list diff --git a/sphinx_doc_src/index.rst b/sphinx_doc_src/index.rst index 25d15b131..9515825a0 100644 --- a/sphinx_doc_src/index.rst +++ b/sphinx_doc_src/index.rst @@ -439,7 +439,7 @@ For example, the following is a function definition that calls the command ``ls` ls -l $argv end -The first line tells fish that a function by the name of ``ll`` is to be defined. To use it, simply write ``ll`` on the commandline. The second line tells fish that the command ``ls -l $argv`` should be called when ``ll`` is invoked. '``$argv``' is an array variable, which always contains all arguments sent to the function. In the example above, these are simply passed on to the ``ls`` command. For more information on functions, see the documentation for the :ref:`function ` builtin. +The first line tells fish that a function by the name of ``ll`` is to be defined. To use it, simply write ``ll`` on the commandline. The second line tells fish that the command ``ls -l $argv`` should be called when ``ll`` is invoked. '``$argv``' is a list variable, which always contains all arguments sent to the function. In the example above, these are simply passed on to the ``ls`` command. For more information on functions, see the documentation for the :ref:`function ` builtin. .. _syntax-function-wrappers: @@ -469,7 +469,7 @@ Autoloading functions Functions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. This method of defining functions has several advantages. An autoloaded function becomes available automatically to all running shells. If the function definition is changed, all running shells will automatically reload the altered version. Startup time and memory usage is improved, etc. -Fish automatically searches through any directories in the array variable ``$fish_function_path``, and any functions defined are automatically loaded when needed. A function definition file must have a filename consisting of the name of the function plus the suffix '``.fish``'. +Fish automatically searches through any directories in the list variable ``$fish_function_path``, and any functions defined are automatically loaded when needed. A function definition file must have a filename consisting of the name of the function plus the suffix '``.fish``'. By default, Fish searches the following for functions, using the first available file that it finds: @@ -655,7 +655,7 @@ Functions beginning with the string ``__fish_print_`` print a newline separated Where to put completions ------------------------ -Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the array variable ``$fish_complete_path``, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix '``.fish``'. +Completions can be defined on the commandline or in a configuration file, but they can also be automatically loaded. Fish automatically searches through any directories in the list variable ``$fish_complete_path``, and any completions defined are automatically loaded when needed. A completion file must have a filename consisting of the name of the command to complete and the suffix '``.fish``'. By default, Fish searches the following for completions, using the first available file that it finds: @@ -756,7 +756,7 @@ Examples:: begin; set -l IFS; set data (cat data.txt); end # Set the ``data`` variable to the contents of 'data.txt' - # without splitting it into an array. + # without splitting it into a list. .. _expand-brace: @@ -844,7 +844,7 @@ The ``$`` symbol can also be used multiple times, as a kind of "dereference" ope # 20 # 30 -When using this feature together with array brackets, the brackets will always match the innermost ``$`` dereference. Thus, ``$$foo[5]`` will always mean the fifth element of the ``foo`` variable should be dereferenced, not the fifth element of the doubly dereferenced variable ``foo``. The latter can instead be expressed as ``$$foo[1][5]``. +When using this feature together with list brackets, the brackets will always match the innermost ``$`` dereference. Thus, ``$$foo[5]`` will always mean the fifth element of the ``foo`` variable should be dereferenced, not the fifth element of the doubly dereferenced variable ``foo``. The latter can instead be expressed as ``$$foo[1][5]``. .. _cartesian-product: @@ -902,7 +902,7 @@ Examples:: Index range expansion --------------------- -Both command substitution and shell variable expansion support accessing only specific items by providing a set of indices in square brackets. It's often needed to access a sequence of elements. To do this, use the range operator '``..``' for this. A range '``a..b``', where range limits 'a' and 'b' are integer numbers, is expanded into a sequence of indices '``a a+1 a+2 ... b``' or '``a a-1 a-2 ... b``' depending on which of 'a' or 'b' is higher. The negative range limits are calculated from the end of the array or command substitution. Note that invalid indexes for either end are silently clamped to one or the size of the array as appropriate. +Both command substitution and shell variable expansion support accessing only specific items by providing a set of indices in square brackets. It's often needed to access a sequence of elements. To do this, use the range operator '``..``' for this. A range '``a..b``', where range limits 'a' and 'b' are integer numbers, is expanded into a sequence of indices '``a a+1 a+2 ... b``' or '``a a-1 a-2 ... b``' depending on which of 'a' or 'b' is higher. The negative range limits are calculated from the end of the list or command substitution. Note that invalid indexes for either end are silently clamped to one or the size of the list as appropriate. Range expansion will go in reverse if the end element is earlier in the list than the start and forward if the end is later than the start, unless exactly one of the given indices is negative. This is to enable clamping without changing direction if the list has fewer elements than expected. @@ -1103,18 +1103,18 @@ Variables can be explicitly set to be exported with the ``-x`` or ``--export`` s -# If a variable has global scope, it is accessible read-write to functions whether it is exported or not. -.. _variables-arrays: +.. _variables-lists: -Arrays +Lists ------- -``fish`` can store a list of multiple strings inside of a variable. To access one element of an array, use the index of the element inside of square brackets, like this: +``fish`` can store a list (or an "array" if you wish) of multiple strings inside of a variable. To access one element of a list, use the index of the element inside of square brackets, like this: ``echo $PATH[3]`` -Note that array indices start at 1 in ``fish``, not 0, as is more common in other languages. This is because many common Unix tools like ``seq`` are more suited to such use. An invalid index is silently ignored resulting in no value being substituted (not an empty string). +Note that list indices start at 1 in ``fish``, not 0, as is more common in other languages. This is because many common Unix tools like ``seq`` are more suited to such use. An invalid index is silently ignored resulting in no value being substituted (not an empty string). -If you do not use any brackets, all the elements of the array will be written as separate items. This means you can easily iterate over an array using this syntax:: +If you do not use any brackets, all the elements of the list will be written as separate items. This means you can easily iterate over a list using this syntax:: for i in $PATH; echo $i is in the path; end @@ -1122,9 +1122,9 @@ To create a variable ``smurf``, containing the items ``blue`` and ``small``, sim set smurf blue small -It is also possible to set or erase individual elements of an array:: +It is also possible to set or erase individual elements of a list:: - # Set smurf to be an array with the elements 'blue' and 'small' + # Set smurf to be a list with the elements 'blue' and 'small' set smurf blue small # Change the second element of smurf to 'evil' @@ -1137,13 +1137,13 @@ It is also possible to set or erase individual elements of an array:: echo $smurf -If you specify a negative index when expanding or assigning to an array variable, the index will be calculated from the end of the array. For example, the index -1 means the last index of an array. +If you specify a negative index when expanding or assigning to a list variable, the index will be calculated from the end of the list. For example, the index -1 means the last index of a list. A range of indices can be specified, see `index range expansion <#expand-index-range>`_ for details. -All arrays are one-dimensional and cannot contain other arrays, although it is possible to fake nested arrays using the dereferencing rules of `variable expansion <#expand-variable>`_. +All lists are one-dimensional and cannot contain other lists, although it is possible to fake nested lists using the dereferencing rules of `variable expansion <#expand-variable>`_. -When an array is exported as an environment variable, it is either space or colon delimited, depending on whether it is a path variable:: +When a list is exported as an environment variable, it is either space or colon delimited, depending on whether it is a path variable:: set -x smurf blue small set -x smurf_PATH forest mushroom @@ -1154,7 +1154,7 @@ When an array is exported as an environment variable, it is either space or colo -``fish`` automatically creates arrays from all environment variables whose name ends in PATH, by splitting them on colons. Other variables are not automatically split. +``fish`` automatically creates lists from all environment variables whose name ends in PATH, by splitting them on colons. Other variables are not automatically split. .. _variables-path: @@ -1163,7 +1163,7 @@ PATH variables Path variables are a special kind of variable used to support colon-delimited path lists including PATH, CDPATH, MANPATH, PYTHONPATH, etc. All variables that end in ``PATH`` (case-sensitive) become PATH variables. -PATH variables act as normal arrays, except they are are implicitly joined and split on colons. +PATH variables act as normal lists, except they are are implicitly joined and split on colons. :: @@ -1186,9 +1186,9 @@ Special variables The user can change the settings of ``fish`` by changing the values of certain variables. -- ``PATH``, an array of directories in which to search for commands +- ``PATH``, a list of directories in which to search for commands -- ``CDPATH``, an array of directories in which to search for the new directory for the ``cd`` builtin. +- ``CDPATH``, a list of directories in which to search for the new directory for the ``cd`` builtin. - ``LANG``, ``LC_ALL``, ``LC_COLLATE``, ``LC_CTYPE``, ``LC_MESSAGES``, ``LC_MONETARY``, ``LC_NUMERIC`` and ``LC_TIME`` set the language option for the shell and subprograms. See the section `Locale variables <#variables-locale>`_ for more information. @@ -1208,7 +1208,7 @@ The user can change the settings of ``fish`` by changing the values of certain v empty string, history is not saved to disk (but is still available within the interactive session). -- ``fish_user_paths``, an array of directories that are prepended to ``PATH``. This can be a universal variable. +- ``fish_user_paths``, a list of directories that are prepended to ``PATH``. This can be a universal variable. - ``umask``, the current file creation mask. The preferred way to change the umask variable is through the :ref:`umask ` function. An attempt to set umask to an invalid value will always fail. @@ -1218,9 +1218,9 @@ The user can change the settings of ``fish`` by changing the values of certain v - ``_``, the name of the currently running command (though this is deprecated, and the use of ``status current-command`` is preferred). -- ``argv``, an array of arguments to the shell or function. ``argv`` is only defined when inside a function call, or if fish was invoked with a list of arguments, like ``fish myscript.fish foo bar``. This variable can be changed by the user. +- ``argv``, a list of arguments to the shell or function. ``argv`` is only defined when inside a function call, or if fish was invoked with a list of arguments, like ``fish myscript.fish foo bar``. This variable can be changed by the user. -- ``history``, an array containing the last commands that were entered. +- ``history``, a list containing the last commands that were entered. - ``HOME``, the user's home directory. This variable can be changed by the user. @@ -1232,7 +1232,7 @@ The user can change the settings of ``fish`` by changing the values of certain v - ``status``, the `exit status <#variables-status>`_ of the last foreground job to exit. If the job was terminated through a signal, the exit status will be 128 plus the signal number. -- ``pipestatus``, an array of exit statuses of all processes that made up the last executed pipe. +- ``pipestatus``, a list of exit statuses of all processes that made up the last executed pipe. - ``USER``, the current username. This variable can be changed by the user. diff --git a/sphinx_doc_src/tutorial.rst b/sphinx_doc_src/tutorial.rst index 668e4b195..8a2ea9fd3 100644 --- a/sphinx_doc_src/tutorial.rst +++ b/sphinx_doc_src/tutorial.rst @@ -246,7 +246,7 @@ Unlike other shells, ``fish`` stores the exit status of the last command in ``$s 1 -Zero is considered success, and non-zero is failure. There is also a ``$pipestatus`` array variable for the exit statues of processes in a pipe. +Zero is considered success, and non-zero is failure. There is also a ``$pipestatus`` list variable for the exit statues of processes in a pipe. Exports (Shell Variables)