Assigning variable value in right behalf of pipeline has no effect
From:
xandrous
Subject:
Assigning variable value in right behalf of pipeline has no effect
Date:
Thu, 5 Jul 2007 03:33:37 +0400
Hi, bash developers!
I've noticed strange bash behaviour. If I assign variable value in
right behalf of pipeline it has no effect. Just try to execute:
XXX=10; { XXX=20; } | read; echo $XXX
XXX=10; { XXX=20; }; echo $XXX
I suppose both of them should output '20' but the first one outputs
'10'. Is it feature of bug?
This behaviour is the same for at least following bash versions: 2.05,
3.0.16 and the recent 3.2.