Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: refering to 2nd from last history parameter?



Hi,

On Thu, Jan 22, 2015 at 06:52:01PM +0300, ZyX wrote:
> > 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*.”

Thanks for the heads up. I actually expected (and looked for) a
literal mention of "-x".

> > 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.

Yeah, well, depends. :-)

		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: Reverse Date, Date, Thread, Author