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

Re: [PATCH?] Nofork and removing newlines



On Wed, Mar 6, 2024 at 11:02 PM Lawrence Velázquez <larryv@xxxxxxx> wrote:
>
> Hm, would it be feasible to create an explicit LF-preserving form
> using a different character (e.g., ${&cmd})?  If so, would it be
> undesirable for some other reason?

Other than that we've just about run out of characters?

${< should be reserved for reading a file, as already suggested
elsewhere (no, I'm not going to implement that yet, though it seems to
be an undocumented ksh93 feature).

${> might work, but it "looks wrong" to have a command instead of a
file to the right of the pointy end.

${& looks like you're running something asynchronously, or perhaps
changing a file descriptor.

Every other character already has another meaning in that position, as
far as I can tell.

There is one other possibility:  ${||command}, that is,
${|var|command} with an empty var name.  That's already passed through
the lexer, so it could be picked out at the necessary place in subst.c
(I think, haven't actually tried yet).  It looks a little odd, too,
given "||" usually means "or", but it's at least sort of logical to
treat "assign this output to nothing" as "return the output in place",
and the other ${|...} forms do preserve trailing newlines.




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