From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3208 invoked by alias); 22 Jan 2015 15:58:36 -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: 19766 Received: (qmail 24510 invoked from network); 22 Jan 2015 15:58:23 -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=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_FSL_HELO_BARE_IP_2 autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1421941921; bh=Al0gUuEZoMgTy1w2qOy5cJeP27YAUE5Qu716+C+0Pvg=; h=From:To:In-Reply-To:References:Subject:Date; b=dcJlG3A35Ts+skaMbyGMCAzeQ1JT5Gdh3UIlALOWDE+Z3ApvCKjKoElmk6n9CvWFo lBiLhbh713H6y4fXq8RjaKbBISvPshM4LrVOjLO+IexMLlJ5Kmtmt4/6HE4bxzIFP6 WsN1ROzmvFhrzcDQD/kfZtyTgfbMTeMXksMNey94= From: ZyX To: Axel Beckert , "zsh-users@zsh.org" In-Reply-To: <20150122134016.GV26664@sym.noone.org> References: <20150122134016.GV26664@sym.noone.org> Subject: Re: refering to 2nd from last history parameter? MIME-Version: 1.0 Message-Id: <3006201421941921@web23g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Thu, 22 Jan 2015 18:52:01 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 22.01.2015, 16:42, "Axel Beckert" : > Hi, > > On Thu, Jan 22, 2015 at 12:18:19PM +0000, zzapper wrote: >>  I don't think it's possible >> >>  ls !$    last parameter of previous command >> >>  echo a b c d e f g h >> >>  I don't think I can grab 'g' without counting left to right > > Interesting question. > > I would have expected that using negativ numbers would work (with > CSH_JUNKIE_HISTORY enabled of course): > >   % echo !:-2 > > But this actually seems an abbreviation for > >   % echo !:0-2 > > despite this is not documented in the man page. (I may come up with a > documentation patch for that later.) It is documented:“x-y A range of words; x *defaults to 0*.” > > It though seems consistent with tcsh which behaves the same way. > > Despite I never thought about it so far, I'd use such a feature if I > knew it exists. Would come in handy with many rsync/scp/cp/etc. > command-lines to reuse the source argument if there were a bunch of > dashed options before it. > > I wonder what would be a good syntax for such a feature as "-n" > seems already taken. Maybe something " >   % echo !:<2 > > (And would we count from 0 or from 1, i.e. would "!:<0" or "!:<1" be a > synonym for "!:$"? :-) I would say that `!:<1` resulting in a second word counted from the end is rather unexpected. > >                 Kind regards, Axel > -- > /~\  Plain Text Ribbon Campaign                   | Axel Beckert > \ /  Say No to HTML in E-Mail and News            | abe@deuxchevaux.org  (Mail) >  X   See http://www.nonhtmlmail.org/campaign.html | abe@noone.org (Mail+Jabber) > / \  I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)