From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from postman.osf.org ([130.105.1.152]) by hawkwind.utcs.toronto.edu with SMTP id <2060>; Wed, 15 Sep 1993 15:00:54 -0400 Received: from sulphur.osf.org by postman.osf.org (5.64+/OSF 1.0) id AA08474; Wed, 15 Sep 93 15:00:30 -0400 Received: by sulphur.osf.org (1.37.109.4/4.7) id AA27956; Wed, 15 Sep 93 15:01:03 -0400 Date: Wed, 15 Sep 1993 15:01:03 -0400 From: rsalz@osf.org Message-Id: <9309151901.AA27956@sulphur.osf.org> To: rc-owner@hawkwind.utcs.toronto.edu, rc@hawkwind.utcs.toronto.edu Subject: Re: list operators ; * = ( 4 5 6 7 ) ; echo $* 4 5 6 7 ; shift -3 ; echo $* 4 # rshift varname count fn rshift { i=() save=() tmp=() { count=`{ expr $#$1 - $2 } ~ $count -* && { echo cannot rshift >[1=2]; return 1 } save=$1 *=( $$1 ) for (i) { tmp=( $tmp $i ) ~ $#tmp $count && break } $save=( $tmp ) } } rn rshift-test { foo=(1 2 3 4 5 6) echo foo before is $foo rshift foo 2 echo foo after is $foo echo echo foo before is $foo rshift foo 12 || echo rshift failed. echo foo after is $foo } foo before is 1 2 3 4 5 6 foo after is 1 2 3 4 foo before is 1 2 3 4 cannot rshift rshift failed. foo after is 1 2 3 4