Dan Jacobson <jidanni@deadspam.com> wrote:
> I suppose $? in line 1 got expanded after a subshell started,
Right; this is related to FAQ entry E4.
> and $$ got expanded before it started?
Right. man bash:
$ Expands to the process ID of the shell. In a ()
subshell, it expands to the process ID of the curÂ
rent shell, not the subshell.
This could be clarified, since the pipeline introduces a subshell
which is not a () subshell.
paul