Chet Ramey <chet.ramey@case.edu> wrote:
> On 6/29/20 4:33 PM, Dmitry Alexandrov wrote:
>> 1) unexpected, as (a) it does not seem to be documented, (b) itʼs
>> counter-intuitive and (c) other bourne-like shells (busybox ash, dash,
>> ksh93, mksh, zsh) does not do that;
>
> It's an opportunity for optimization, not a bug
I am not saying that this is a bug, only that it is inconsistent with almost
any other bourne-like shell.
>> 2) inconvenient, as in some cases PID of the parent shell is not an
>> appropriate substitute for the PID of the real process.
> since the results are correct.
The results are _different_ across shell and, unfortunately, results provided
by Bash are the least useful. Consider:
$ command … &
[1] 30737
$ strace -p $!
strace: Process 30737 attached
wait4(-1,
:-/