On 9/29/16 11:49 PM, Martijn Dekker wrote:
> I detected an oddity (possible bug) in bash: the usual optimisation for
> launching external processes in simple command substitutions is turned
> off while executing a dot script.
Thanks for the suggestion. I added the optimization to command
substitu
On 9/29/16 11:49 PM, Martijn Dekker wrote:
> I detected an oddity (possible bug) in bash: the usual optimisation for
> launching external processes in simple command substitutions is turned
> off while executing a dot script.
>
> Background: For reasons that would take too much space to explain he
2016-09-30 04:49:33 +0100, Martijn Dekker:
[...]
> my_subshell_pid=$(sh -c 'echo $PPID')
>
> This works fine on every shell, except on bash when a dot script is
> being executed.
[...]
While it does look like a bug, you could always do:
my_subshell_pid=$(exec sh -c 'echo $PPID')
To be sur