Skip to content

Conversation

@ulm
Copy link
Member

@ulm ulm commented Dec 19, 2025

This is based on the EAPI cheat sheet, plus some additions.

@ulm ulm marked this pull request as draft December 19, 2025 09:38

<li>
New form of command substitution: <c>${ command; }</c> or
<c>${|command;}</c> to capture the output of <c>command</c> without
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If commandis a shell function, then this avoids the overhead of forking.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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"?

Copy link
Member Author

@ulm ulm Dec 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume one use case of {| command } is command also 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.

@ulm ulm force-pushed the eapi-9 branch 4 times, most recently from 949a15e to 5e89761 Compare December 21, 2025 21:53
@ulm ulm changed the title ebuild-writing/eapi: Start working on EAPI 9 section ebuild-writing/eapi: Add section for EAPI 9 Dec 22, 2025
@ulm ulm marked this pull request as ready for review December 22, 2025 08:24
@ulm ulm requested review from mgorny and thesamesam December 22, 2025 08:24
ulm added 2 commits January 1, 2026 18:10
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
Based on the EAPI cheat sheet.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
@ulm
Copy link
Member Author

ulm commented Jan 1, 2026

If there are no further comments, then I'm going to merge this tomorrow.

@ulm ulm requested a review from thesamesam January 1, 2026 21:00
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
@gentoo-bot gentoo-bot merged commit 532b317 into gentoo:master Jan 2, 2026
1 check passed
@ulm ulm deleted the eapi-9 branch January 2, 2026 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants