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

Re: ideas



Bernd Eggink wrote:
> > You could just use $i(:s/foo/bar).
> 
> Great! I, too, was wondering why there isn't such a thing. Now I wonder
> if this feature is considered top secret. I can't find anything about it
> in the docu.

I've been waiting and waiting for someone to point out that
${i:s/foo/bar/} does work (and has worked for years and years), you
just need the final / (though I'm working on that, too), but no-one
has.  I can't believe no-one else knew?

Looking at the documentation, I can see the confusion:  it's mentioned
in the history section that modifiers also work on parameters, but not
in the parameter section.

*** Doc/Zsh/expn.yo.pmod	Fri Feb  6 10:22:26 1998
--- Doc/Zsh/expn.yo	Thu Mar 19 09:49:58 1998
***************
*** 167,173 ****
  for a description of parameters.
  In the expansions discussed below that require a pattern, the form of
  the pattern is the same as that used for filename generation;
! see noderef(Filename Generation).
  
  startitem()
  item(tt(${)var(name)tt(}))(
--- 167,176 ----
  for a description of parameters.
  In the expansions discussed below that require a pattern, the form of
  the pattern is the same as that used for filename generation;
! see noderef(Filename Generation).  In addition to the following
! operations, the file modifiers described in noderef(Modifiers) can be
! applied:  for example, tt(${i:s/foo/bar/}) performs string
! substitution on the value of parameter tt($i).
  
  startitem()
  item(tt(${)var(name)tt(}))(

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author