Jirka Kosina <jikos@jikos.cz> wrote:
> P=0 ; { P=1; echo $P; } | { cat -; echo $P; }
>
> I get
> 1
> 0
>
> Though I would accept
You mean "expect", not "accept".
> 1
> 1
>
> as commands between { } are executed in the same shell, which made P=0.
They are *not* run in the same process. Each command in a pipeline is
run in its own process. See FAQ entry E4.
paul