New rc shell feature

Based on an original idea and initial code by Erik Quanstrom, Russ Cox has implemented a new feature in the rc shell to allow subscripts that select a sequence (ie., range) of items.

The extended syntax for subscript notation is like this:

; foo = (a b c d)
; echo $foo(2-3)
b c
echo $foo(2-)
b c d

Russ points out in the patch(1) he submitted to sources that this allows to replace the old idiom:

; *=($x); shift; x=($*)

with the much cleaner:

; x=$x(2-)

This change was committed a few weeks ago to both the main (native) Plan 9 tree and the Plan 9 from User Space tree.

To post a comment you need to login first.