Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH?] Nofork and removing newlines
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author