bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mapfile doesn't accept input from a pipe


From: Greg Wooledge
Subject: Re: mapfile doesn't accept input from a pipe
Date: Thu, 29 Jun 2017 09:55:33 -0400
User-agent: Mutt/1.8.3 (2017-05-23)

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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]