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

Re: refering to 2nd from last history parameter?


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?


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.

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

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

		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