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

Re: :s modifier right-hand-side value behaves strangely with a variable



I understand better now.

There's a section in the manual that explains how `:s` is evaluated,
but I hadn't understood it that way. With your example, it becomes
crystal clear. It would be good to add these examples to that section
of the manual.

Le dim. 23 août 2026 à 23:52, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> a écrit :
On Sun, Aug 23, 2026 at 1:22 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> You're making an incorrect assumption about evaluation order.

To add a little more color to this:  With HIST_SUBST_PATTERN the
evaluation order changes, "s/b/$rep" does become "s/b/_".  This is
handled at the level of the actual replacements, not at the point
where $str:s/b/$rep is initially parsed.


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