From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19727 invoked by alias); 12 Oct 2015 16:43:03 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20744 Received: (qmail 23416 invoked from network); 12 Oct 2015 16:43:00 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f5-f794b6d000001495-82-561be311d818 Date: Mon, 12 Oct 2015 17:42:29 +0100 From: Peter Stephenson To: Ray Andrews , Zsh Users Subject: Re: subsitutions and beginning of lines. Message-id: <20151012174229.10eafc03@pwslap01u.europe.root.pri> In-reply-to: <561BD771.6000006@eastlink.ca> References: <561AB49A.4060801@eastlink.ca> <20151012022637.GB2464@tarsus.local2> <561BD771.6000006@eastlink.ca> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrLLMWRmVeSWpSXmKPExsVy+t/xK7qCj6XDDBbsl7ZY/3sKo8WOkysZ HZg8DrfMYvZYdfADUwBTFJdNSmpOZllqkb5dAlfGq4cb2ArOsVf0PG1iaWD8w9rFyMkhIWAi MePKHWYIW0ziwr31bF2MXBxCAksZJfp7l7CDJIQEGpgkXvaYQSS2MUo0LbrABpJgEVCVeHPh LxOIzSZgKDF102xGEFtEwF3iwIvbYBuEgeLvL94Di/MK2EscvnIGbCingLbEl9mfGCEWFErs 71wIdgW/gL7E1b+fmCAuspeYeeUMVK+gxI/J91hAbGYBLYnN25pYIWx5ic1r3jJDzFGXuHF3 N/sERqFZSFpmIWmZhaRlASPzKkbR1NLkguKk9FwjveLE3OLSvHS95PzcTYyQQP66g3HpMatD jAIcjEo8vBxbpMKEWBPLiitzDzFKcDArifAqTZQOE+JNSaysSi3Kjy8qzUktPsQozcGiJM47 c9f7ECGB9MSS1OzU1ILUIpgsEwenVANj5YejFvs7Ss7oWMov/SCfoav5Xb2gSaJ//rM7T85+ 07Ao3dRzjm/f3+J3z7y5Xu4wZE4oOqilK3vS//EWeWOJaUyPNCfPzXVdYndUdNaC1wILkydH Sa874pnw6vK3MD5pQSaNxezhWQnC4lsTH6xgqqnjTJ1stLPsiBijwPaXiRwFoZe0Zt1TYinO SDTUYi4qTgQAjRDWBWACAAA= On Mon, 12 Oct 2015 08:53:21 -0700 Ray Andrews wrote: > On 10/11/2015 07:26 PM, Daniel Shahaf wrote: > > You could avoid parsing the line numbers (and unescaping the commands) > > altogether by accessing the history differently: > > > % print -r - $history[1004] echo foo > > I could never get that to work with anything besides a single > subscript. I'd expect it > to drive like any other array but nothing seems to work: > > print -lr - $history[-5,-1] > > ... and the point of what I'm doing is to show a range. It's an associative array, so you need the exact index as a decimal with no leading zeros; ranges and reverse indices don't work. % print ${(t)history} association-readonly-hide-hideval-special But you can fake something like that above up: local -a myhist=() indices=({$((HISTCMD-5))..$((HISTCMD-1))}) integer ind for ind in $indices; do myhist+=(${history[$ind]}) done pws