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

Re: refering to 2nd from last history parameter?



Hi Peter,

On Mon, Jan 26, 2015 at 02:32:12PM +0000, Peter Stephenson wrote:
> > 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.

Indeed:

→ echo foo bar
foo bar
→ echo !$-1
zsh: no such word in event

I must admit, I'm surprised that I obviously never ran into that.

Thanks for the heads up!

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

*nod*

		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