From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120180 invoked by alias); 16 Jul 2018 01:06:23 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 120103 invoked by uid 89); 16 Jul 2018 01:06:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=redirect, H*M:1c69fb81, H*M:google X-HELO: mail-oi0-f51.google.com Received: from mail-oi0-f51.google.com (HELO mail-oi0-f51.google.com) (209.85.218.51) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 16 Jul 2018 01:06:20 +0000 Received: by mail-oi0-f51.google.com with SMTP id n84-v6so71770500oib.9 for ; Sun, 15 Jul 2018 18:06:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:to:subject:references:user-agent; bh=PChy9o7WAG6iXJXV2PdpfqNbnYm62kdYVna0fqoK9Yg=; b=ASxHiXeMZ2gZvoo2Yzi117Extct2MQ9qdiLivSF2LCcwbvoJDfJU18DqkwNP9MPPwF 4c2Kjxpf15ywxWg8Vmi9MBH2FIMAVJqphb4uK+vm6Lk0dYx01Es+5RnQmecc3eKY/Npg uzAgcGafbepot5Meb/CY4crh8VA7fxRT5JTdo5sGOEyJZmcQttNL9nX5PouXoKGmJRUp xeTsP0q6/A5B3OIITx/SSI5FpAiH+2W5q3/35O3r9gbv6og76FYZexfbbOPJdXcKMl8I Vk/c1cRb6UuC2FwIAA3eLfPqxEQ7PKhciDdN+A4DM0wdfHFeU/zd2Qfj6cNVPSA37aMB sosA== Return-Path: Received: from rQM ([2605:6000:9fc0:56:74e1:152f:4300:b4a6]) by smtp.gmail.com with ESMTPSA id r10-v6sm8721500oif.37.2018.07.15.18.06.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Jul 2018 18:06:18 -0700 (PDT) Message-ID: <5b4bef8a.1c69fb81.33aa5.63f9@mx.google.com> Date: Tue, 17 Jul 2018 12:57:00 -0000 From: Steven Penny To: cygwin@cygwin.com Subject: Re: BASH 4.4 mapfile/readarray/read builtins mis-behaving with pipe References: <69b0bc3c-7ead-920e-f04b-ec631c3453b7@verizon.net> Content-Type: text/plain; charset=utf8; format=flowed User-Agent: Tryst/2.7.0 (github.com/svnpenn/tryst) X-SW-Source: 2018-07/txt/msg00159.txt.bz2 On Sun, 15 Jul 2018 19:01:21, BloomingAzaleas wrote: > CASE: > echo multi-line_arg | read foo > cat multi-line_unix_fmt_file | read foo > =C2=A0RESULT: > Fail with variable foo null or unset > > CASES: left chev re-directions > mapfile < some_unix_fmt_file > mapfile < read < some_unix_fmt_file > read < RESULT: > Work as expected > > CASES: mapfile or read in a sub-shell > echo multi-line_arg | ( mapfile ; stuff ) > echo multi-line_arg | ( read foo; stuff ) > RESULT: > Work as expected.=C2=A0 However, since mapfile/read result vars are=20 > not accessible in parent shell context, can force a notable=20 > re-structuring of a script to use sub-shells. no mis-behaving: this is intended behavior - you yourself have given workarounds: either redirect output to a file that can be later read, or pipe to command grouping ala {} or () and read stdin from inside the subshell im not sure what you are asking here - it seems you have a grasp already of the "problem" and "solution" - so nothing more needs to be said really, as nothing needs to be fixed - another option is "lastpipe" http://mywiki.wooledge.org/BashFAQ/024 -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple