1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 05:16:05 +01:00

49813: <<<: Document newline behavior and fix optimization

The =(<<<foo) optimization forgot to add a newline, but =(cat<<<foo)
always did, make the behavior consistent, and document it.
This commit is contained in:
Mikael Magnusson 2022-03-08 19:34:20 +01:00
parent 3bf95b91f0
commit d7b8619396
3 changed files with 8 additions and 2 deletions

View file

@ -15,6 +15,9 @@
* 49870: Src/glob.c: Fix NULL reference in match code more
* 49813: Doc/Zsh/redirect.yo, Src/exec.c: <<<: Document newline
behavior and fix optimization
2022-03-29 Bart Schaefer <schaefer@zsh.org>
* 49918: NEWS, README: Update for 49917 and 49911.

View file

@ -86,7 +86,8 @@ item(tt(<<<) var(word))(
Perform shell expansion on var(word) and pass the result
to standard input. This is known as a em(here-string).
Compare the use of var(word) in here-documents above, where var(word)
does not undergo shell expansion.
does not undergo shell expansion. The result will have a trailing newline
after it.
)
xitem(tt(<&) var(number))
item(tt(>&) var(number))(

View file

@ -4836,8 +4836,10 @@ getoutputfile(char *cmd, char **eptr)
singsub(&s);
if (errflag)
s = NULL;
else
else {
untokenize(s);
s = dyncat(s, "\n");
}
}
if (!s) /* Unclear why we need to do this before open() */