From: Oliver Kiddle <opk@zsh.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: zsh-workers@zsh.org
Subject: Re: [PATCH?] Nofork and removing newlines
Date: Fri, 08 Mar 2024 23:15:02 +0100 [thread overview]
Message-ID: <90726-1709936102.086878@xlWC.oGpX.V4Q4> (raw)
In-Reply-To: <CAH+w=7b24HxJMGUBqjC7Fgx3ycLWwAuK0CTpwSSryb0XXxEHMw@mail.gmail.com>
Bart Schaefer wrote:
> ${< 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.
I agree. I'd sooner expect that to be running $NULLCMD redirected to a file.
Not that that would be even remotely useful.
> Every other character already has another meaning in that position, as
> far as I can tell.
It could be nice to have ${= cmd } as a shorter alternative to
${=${ cmd }} particularly if the default is to be newline preserving.
That would need to do word splitting but trailing IFS characters also
get removed so it would work for some cases.
> 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.
The logic does at least follow from the usage with a variable. One way
to avoid the resemblance to an "or" is if ${| |command} also works.
It could perhaps be combined so ${||<file} slurps a file unmodified.
Why does it print command not found errors for things like ${|=|:},
${|*|:} and ${|?|:}, I'd rather have $? than it globbing for a single
character file.
Oliver
next prev parent reply other threads:[~2024-03-08 22:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-05 5:52 Bart Schaefer
2024-03-05 6:56 ` Stephane Chazelas
2024-03-05 22:48 ` Bart Schaefer
2024-03-06 17:57 ` Stephane Chazelas
2024-03-06 19:45 ` Bart Schaefer
2024-03-06 22:22 ` Mikael Magnusson
2024-03-06 22:42 ` Bart Schaefer
2024-03-07 4:53 ` Bart Schaefer
2024-03-07 7:02 ` Lawrence Velázquez
2024-03-07 8:09 ` ${<file} (Was: [PATCH?] Nofork and removing newlines) Stephane Chazelas
2024-03-08 1:29 ` [PATCH?] Nofork and removing newlines Bart Schaefer
2024-03-08 22:15 ` Oliver Kiddle [this message]
2024-03-08 23:28 ` Bart Schaefer
2024-03-09 20:43 ` Oliver Kiddle
2024-03-10 6:11 ` Bart Schaefer
2024-03-12 17:54 ` Bart Schaefer
2024-03-12 23:19 ` Oliver Kiddle
2024-03-13 4:13 ` Bart Schaefer
2024-03-14 22:15 ` Oliver Kiddle
2024-03-15 8:42 ` Stephane Chazelas
2024-03-27 1:16 ` Bart Schaefer
2024-03-27 7:05 ` Bart Schaefer
2024-03-07 7:10 ` Stephane Chazelas
2024-03-08 0:37 ` Bart Schaefer
2024-03-07 6:52 ` Lawrence Velázquez
2024-03-07 8:26 ` Mikael Magnusson
2024-03-07 19:02 ` Bart Schaefer
2024-04-02 6:45 ` Lawrence Velázquez
2024-03-06 19:43 ` Stephane Chazelas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90726-1709936102.086878@xlWC.oGpX.V4Q4 \
--to=opk@zsh.org \
--cc=schaefer@brasslantern.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).