[buug] loops and pipe sinks are subshells, aaaargh
togo at of.net
Fri Aug 5 11:47:12 PDT 2011
>> Sigh. When I wrote my post I assumed the problem I described would be
>> instantly recognized by any Unix veteran who (I kept assuming) ...
Well, color us whooshed. By the way, you'll get better answers
faster if you provide complete working code in your questions.
It's not always about skill: it can also be about time.
> Yes, instantly recognized. I believe it's also well covered in shell
> FAQ(s) ...
> Among possible approaches:
> echo 'foo 1 ...
Well, you still don't get the variable to the outside of the subshell,
the point of the original question.
# note I changed Michael's shebang because of the bashisms)
echo 'foo 1
output_foo | (
while read item count
More information about the buug