On Wed, Jun 28, 2017 at 07:08:27PM -0700, Keith Thompson wrote:
> Description:
> The "mapfile" command works correctly if stdin is redirected
> from a file, but not if it's from a pipe.
This is because each command in a pipeline is executed in its own subshell.
Not a bug.
If you need to read input from a command with mapfile (or read), use a
process substitution.
> cat /tmp/input.txt | mapfile PIPE
mapfile PIPE < /tmp/input.txt
mapfile PIPE < <(a real program, not cat)