zsh-workers
 help / color / mirror / code / Atom feed
* Nofork and preserving newlines
@ 2024-02-27 20:53 Bart Schaefer
  0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 2024-02-27 20:53 UTC (permalink / raw)
  To: Zsh hackers list

On Tue, Feb 27, 2024 at 11:25 AM Oliver Kiddle <opk@zsh.org> wrote:
>
> Incidentially, trying to use kill -l in that
> manner, it becomes apparent why the `...` and $(...) forms strip
> trailing newlines. Given that it aids compatibility with bash/ksh etc
> and updating old zsh scripts that use $(...) I'm not too sure that it
> preserving newlines is the most helpful behaviour. Parameter flags don't
> appear to work with the new form so adding one of those isn't an option.

You can do ${=${ ... }} or ${(f)${ ... }} but, correct, not e.g. ${(f)
... }.  Consensus during the discussion seemed to be that the extra
layer of braces was not onerous when needed.

The intent was to have ${ ... } act more like parameter substitution.
It might be possible/reasonable to have ${ ... } strip newlines and
"${ ... }" keep them, if that feels better.

I suspect there are not very many old scripts that use purely builtin
commands in $(...), and as noted elsewhere there's really no reason
(other than no newline stripping!) to use ${ ... } for external
commands because zsh optimizes out one fork in $(...) already.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-27 20:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-27 20:53 Nofork and preserving newlines Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).