Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread tetsujin
preventing readers from absorbing the information. - Original Message - From: "Greg Wooledge" To: Cc: Sent:Thu, 29 Jun 2017 15:39:20 -0400 Subject:Re: mapfile doesn't accept input from a pipe On Thu, Jun 29, 2017 at 03:22:24PM -0400, tetsu...@scope-eye.net wrote: > So

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread Greg Wooledge
On Thu, Jun 29, 2017 at 03:22:24PM -0400, tetsu...@scope-eye.net wrote: > So I look at this not just as a RTFM issue, it's a pitfall built-in to > the design of the language, and programmers need to understand a bit > about the implementation of the language to understand what's going > on. As such

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread tetsujin
a pipeline could contain *multiple* built-ins or shell functions with side-effects for the shell's environment) But I think that's a difficult direction to pursue, unfortunately, and I'm guessing it's not one that will happen in Bash...  (On the bright side it sounds as though POSIX

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread Chet Ramey
On 6/29/17 12:38 PM, Keith Thompson wrote: > I suggest that it would be worthwhile to mention this issue in the > documentation. "Each command in a pipeline is executed as a separate process (i.e., in a subshell). See COMMAND EXECUTION ENVIRONMENT for a description of a subshell environment.

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread Keith Thompson
On Thu, Jun 29, 2017 at 6:56 AM, Eduardo A. Bustamante López wrote: > On Wed, Jun 28, 2017 at 07:08:27PM -0700, Keith Thompson wrote: > [...] >> mapfile REDIRECT < /tmp/input.txt >> cat /tmp/input.txt | mapfile PIPE > > The `mapfile PIPE' is a piece of a pipeline, and as such, it r

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread Greg Wooledge
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 r

Re: mapfile doesn't accept input from a pipe

2017-06-29 Thread Eduardo A . Bustamante López
On Wed, Jun 28, 2017 at 07:08:27PM -0700, Keith Thompson wrote: [...] > mapfile REDIRECT < /tmp/input.txt > cat /tmp/input.txt | mapfile PIPE The `mapfile PIPE' is a piece of a pipeline, and as such, it runs in a subshell (different process). See: http://mywiki.wooledge.org/BashFA

mapfile doesn't accept input from a pipe

2017-06-29 Thread Keith Thompson
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security uname output: Linux bomb20 4.8.0-46-generic #49-Ubuntu SMP Fri Mar 31 13:57:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux Mac