2023年2月15日(水) 1:20 Chet Ramey <chet.ra...@case.edu>: > > On 2/13/23 6:43 AM, Koichi Murase wrote: > > > I guess just the support for ksh's ${ list; } [1] would make > > everything simple and clear. One can simply call ${ jobs; }, ${ trap > > -p; }, etc. without thinking about subshells. > > > > [1] https://lists.gnu.org/archive/html/help-bash/2020-05/msg00077.html > > The text about syntatic sugar still applies. > > I haven't checked what POSIX says about the jobs in subshells, > > POSIX requires that the shell execution environment include what is > essentially the jobs list;
Thank you for the information. This is what I wanted to find. Thank you. (At that time, I just quickly searched for the job list, but I couldn't find it. Also the definition of "a job" didn't seem to be given in the standard, but I now found "Background Jobs" in XBD) > https://www.austingroupbugs.net/view.php?id=1254 > > discusses this extensively. However, > > "The jobs utility does not work as expected when it is operating in its own > utility execution environment because that environment has no applicable > jobs to manipulate." > > > > but at > > least Bash maintains a separate "job list" of a subshell (which is > > accessible from the built-in command `jobs') regardless of whether the > > "job control" is turned on or not. > > POSIX requires this: > > "The jobs utility is not dependent on the job control option, as are the > seemingly related bg and fg utilities because jobs is useful for examining > background jobs, regardless of the condition of job control." Thank you for all the information. -- Koichi