diff options
author | 2006-06-04 19:42:03 +1000 | |
---|---|---|
committer | 2006-06-04 19:42:03 +1000 | |
commit | cf35a8e3a5ee724f12f13175d81d89b8d74c997c (patch) | |
tree | 3cd8782596602bf3acde6916f40592188a002692 /doc_src | |
parent | e7e3e8ee74206cd693ab57933251d4381090b20e (diff) |
Add documentation about support for negative indices
darcs-hash:20060604094203-ac50b-6cf671235549eb79d3464a15398b6511057dedde.gz
Diffstat (limited to 'doc_src')
-rw-r--r-- | doc_src/doc.hdr | 4 | ||||
-rw-r--r-- | doc_src/set.txt | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/doc_src/doc.hdr b/doc_src/doc.hdr index 17ff4e3e..bdaebb48 100644 --- a/doc_src/doc.hdr +++ b/doc_src/doc.hdr @@ -747,6 +747,10 @@ set -e smurf[1] echo $smurf </pre> +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 bc03c1e1..2a8b8d9f 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 <code>PATH[1 3 7]</code>, 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. <code>set PATH[1] -PATH[4] /bin /sbin</code>. +PATH[4] /bin /sbin</code>. 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. |