Why is subshell created by background control operator (&) not displayed under pstree was recently closed as a duplicate of Rule for invoking subshell in Bash?.
I can see why people would think it’s a duplicate: both askers are interested in the mechanism by which a subshell is created and how one might use the
pstree command to verify details of the subshell process.
However, this question covers commands being run in the background with the
& control operator while the other question focuses on commands enclosed in parentheses (it also doesn’t mention that pipeline components are also run in subshells).
Both my answer and Gilles’ answer explore how
exec are used to create subshells but these are fundamentals for any question dealing with Unix processes. The rest of my answer is very different from either of the answers to the “duplicate” and wouldn’t be appropriate for the other question.
I usually check the Related questions for possible duplicates (then flag them) before answering a question and was aware of the other question before answering. I found this question to be informative, thought-provoking and offering a greater insight into an aspect of subshells not covered in the “duplicate” question. If you look at my answer, you can see it went through some drastic revisions as I explored the topic and improved my own understanding. While I now feel I have a good grasp of the issue, I’d still like to see more knowledgeable answers to this question.
I’ve read the procedure for re-opening questions which recommends editing the question. However, I don’t think it can be usefully edited to make it less different. One suggestion was to comment on the question – which I’ve done (though it could have been more constructive) and another was to flag the question for moderator attention. I just recently checked my flagged posts list and saw that it was declined:
If you feel something was wrongly closed, either vote to reopen or bring it up on meta.
Since I don’t have enough reputation to vote, I thought I’d post here and see what the community thinks. FWIW, I think the moderation model for Stack Exchange sites works remarkably well and I do my best to contribute by flagging problematic issues when I come across them and checking the various review queues. This is the first time that I’ve ever felt the need to appeal a moderator decision.