From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11800 invoked by alias); 26 Jan 2015 14:32:42 -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: 19783 Received: (qmail 26922 invoked from network); 26 Jan 2015 14:32:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-16-54c64f7055f9 Date: Mon, 26 Jan 2015 14:32:12 +0000 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: refering to 2nd from last history parameter? Message-id: <20150126143212.426f510d@pwslap01u.europe.root.pri> In-reply-to: <20150126131723.GS26664@sym.noone.org> References: <20150126121649.684c22cb@pwslap01u.europe.root.pri> <20150126131723.GS26664@sym.noone.org> 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+NgFlrKLMWRmVeSWpSXmKPExsVy+t/xa7oF/sdCDJouSFrsOLmS0YHRY9XB D0wBjFFcNimpOZllqUX6dglcGcv33GcuWMxTcfDpXPYGxr2cXYycHBICJhLn2r+yQNhiEhfu rWfrYuTiEBJYyiix4sNaZghnEZPEnsm/mSCcbYwSrR2vgRwODhYBVYkrW8VAutkEDCWmbprN CGKLCIhKLF+xmR2kRFjAUuLxHleQMK+AvcS/Z7uZQGxOAWOJR4umM0KMnMIkceviTbAEv4C+ xNW/n5ggLrKXmHnlDCNEs6DEj8n3wC5lFtCS2LytiRXClpfYvOYtM4gtJKAucePubvYJjEKz kLTMQtIyC0nLAkbmVYyiqaXJBcVJ6bmGesWJucWleel6yfm5mxghQftlB+PiY1aHGAU4GJV4 eCdMPBoixJpYVlyZe4hRgoNZSYTX0OdYiBBvSmJlVWpRfnxRaU5q8SFGJg5OqQZGPmHbv6rv 9m+fc3amw+yMX5dmvrNzdCrUu83T9+z9i59XDOM3p67jaON8s2yamo+S2X/RJ1Jpnk3z+STP 5anu3bqpffKtaXFXjsrlVEuW5Jx4NP9Sw5wvv94/Mzddbmxzi2/W2nm2O06qLPy8im+23y6p /68qjl4+IN+RXKfQtOQz5/eG9HzjZUosxRmJhlrMRcWJACbJrA84AgAA On Mon, 26 Jan 2015 14:17:23 +0100 Axel Beckert wrote: > On Mon, Jan 26, 2015 at 12:16:49PM +0000, Peter Stephenson wrote: > > On Mon, 26 Jan 2015 12:05:14 +0000 > > We could special case the meaning here: given that ranges have to be in > > order, a range starting with "$" is by definition useless. It's a bit > > kludgy but this is !-history so it's hard to imagine anyone looking for > > elegance. Does this break anything? > > Depends. > > I'd expect that > > mkdir foo > mv foo foo-1 > > can be abbreviated > > mkdir foo > mv !$ !$-1 > > i.e. that anything behind "!$" except a colon (as in "!$:t" or "!$:h") > is taken literal. That's not how it works at the moment --- because "-" means a range, !$-1 alread has a special meaning, as you'll see if you try it. > > I was wondering about using a different character, but I think any > > solution where "minus" is not encoded by "-" is too obscure to be > > useful. > > I'd still prefer the form of "!!:<1" or shorter "!<2" instead of > anything involving further characters after "$". That's probably doable and easy enough to remember. History's early enough that normal syntactic meanings aren't relevant. > Additionally, I thought we're talking about picking a single argument > counting from the back, not from ranges of arguments -- which then could > be "!<2-4" or "!<4-2". (I'd allow both forms as both can make sense.) Yes, we are, but the point is "-" already *means* range and isn't going to stop doing that. pws