diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 17ff4e3e1..bdaebb48a 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -747,6 +747,10 @@ set -e smurf[1] 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. + \subsection variables-special Special variables The user can change the settings of \c fish by changing the values of diff --git a/doc_src/set.txt b/doc_src/set.txt index bc03c1e13..2a8b8d9f4 100644 --- a/doc_src/set.txt +++ b/doc_src/set.txt @@ -32,7 +32,12 @@ If the variable name is one or more array elements, such as PATH[1 3 7], only those array elements specified will be changed. When array indices are specified to set, multiple arguments may be used to specify additional indexes, e.g. set PATH[1] -PATH[4] /bin /sbin. +PATH[4] /bin /sbin. 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 a variable is explicitly set to either universal, global or local, that setting will be honored. If a variable of the same name exists in a different scope, that variable will not be changed. -# If a variable is not explicitly set to be either universal, global or local, but has been previously defined, the previos variable scope is used.