This is well know, and not a bug. Please read:
http://mywiki.wooledge.org/BashFAQ/024

when you run:

command | while-loop

the 'while-loop' part is executed in a subshell (actually, both commands are).
This means that they're no longer the same process as the main shell, and the
consequence is that they do not share variables.

There are several workarounds, all explained in the Bash FAQ from Wooledge.

Reply via email to