ebuild-writing/eapi: Add section for EAPI 9#384
Conversation
|
|
||
| <li> | ||
| New form of command substitution: <c>${ command; }</c> or | ||
| <c>${|command;}</c> to capture the output of <c>command</c> without |
There was a problem hiding this comment.
Just learned about both of these. What's the point of ${|command;}? The example from the manpage doesn't seem very helpful to me: https://www.gnu.org/software/bash/manual/bash.html#:~:text=while%20this%20construct%20does%20not%20require%20any%20output%20to%20expand%20to
There was a problem hiding this comment.
If commandis a shell function, then this avoids the overhead of forking.
There was a problem hiding this comment.
@Flowdalic you mean for the ${ command; } form, what about the second one, the one that "expands to the value of the REPLY shell variable after command executes"?
There was a problem hiding this comment.
I have expanded the section quite a bit (with some bits and pieces from the Bash manual), but I would be grateful if someone could come up with a real example that could be used in an ebuild.
The ${| REPLY=12345; } example in the Bash manual is indeed pointless because it is equivalent to writing 12345 as a constant.
There was a problem hiding this comment.
@Flowdalic you mean for the
${ command; }form, what about the second one, the one that "expands to the value of the REPLY shell variable after command executes"?
Right, I missed that this is about the piped variant. Sorry.
I assume one use case of {| command } is command also being required to print some status output. But that's just an educated guess.
There was a problem hiding this comment.
I assume one use case of
{| command }iscommandalso being required to print some status output. But that's just an educated guess.
Yes. However, in ebuild context one would use einfo or elog for status output, which don't use stdout but stderr. So I still don't see where it could be useful for us.
949a15e to
5e89761
Compare
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Based on the EAPI cheat sheet. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
|
If there are no further comments, then I'm going to merge this tomorrow. |
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
This is based on the EAPI cheat sheet, plus some additions.