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

RE: hzoli change: $foo:s//r/

Umm, I remember patching this a couple of years ago to give its recent
behaviour. It used to loop infinitely I think. The change never made it into
the manual, so I agree it's undocumented and it's quite reasonable to
change it.   But it did work, I don't consider it a bug, quite a number
of my scripts turned out to use it [they all fell over today :-( ] and I'm
a bit upset at seeing it go just to introduce an unnecessary error message.

Can't we just document it?

From: Zoltan Hidvegi on Tue, Aug 15, 1995 1:05 pm
Subject: Re: hzoli change:  $foo:s//r/
To: Heading Anthony
Cc: zsh-workers

Anthony Heading wrote:
> Sorry I missed this first time round.
> hzoli changelog of Jul 10 says:
> - $foo:s//r/ gives ... error message ... (194)
> Now the following used to work
> % array=(a b c d e)
> % echo $array:s//\&-\&/
> a-a b-b c-c d-d e-e
> I remember I had a use for this once...

The problem is that the manual says that zsh should use the left-hand-side of
the last substitution if the substitution string is empty.  And the history
code also does this.  Also the code in hist.c which produced that feature you
describe was buggy and it sometimes got into an infinite loop (or did some
even worse thing).  So what you used so far was probably an undocumented bug.
Maybe we can find an other syntax for that.


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