mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-20 16:11:14 -03:00
Changelog range expansion change, expand docs
This commit is contained in:
@@ -631,7 +631,7 @@ Examples:
|
||||
|
||||
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.
|
||||
|
||||
Range expansion will go in reverse if the end element is earlier in the list 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.
|
||||
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.
|
||||
|
||||
Some examples:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user