Zsh Mailing List Archive
Messages sorted by:
Re: refering to 2nd from last history parameter?
- X-seq: zsh-users 19766
- From: ZyX <kp-pav@xxxxxxxxx>
- To: Axel Beckert <abe@xxxxxxxxxxxxxxx>, "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: Re: refering to 2nd from last history parameter?
- Date: Thu, 22 Jan 2015 18:52:01 +0300
- 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=
- In-reply-to: <20150122134016.GV26664@sym.noone.org>
- List-help: <mailto:email@example.com>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <XnsA42A7D32D20B8davidrayninfocouk@188.8.131.52> <20150122134016.GV26664@sym.noone.org>
22.01.2015, 16:42, "Axel Beckert" <abe@xxxxxxxxxxxxxxx>:
> 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 "<n" as in e.g.
> % 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@xxxxxxxxxxxxxxx (Mail)
> X See http://www.nonhtmlmail.org/campaign.html | abe@xxxxxxxxx (Mail+Jabber)
> / \ I love long mails: http://email.is-not-s.ms/ | http://abe.noone.org/ (Web)
Messages sorted by: