From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28255 invoked by alias); 2 Jun 2018 06:58:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 23426 Received: (qmail 19455 invoked by uid 1010); 2 Jun 2018 06:58:53 -0000 X-Qmail-Scanner-Diagnostics: from aurora-borealis.phear.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(94.242.205.164):SA:0(-1.9/5.0):. Processed in 1.47199 secs); 02 Jun 2018 06:58:53 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: eiro@phear.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: amavisd-new at phear.org DKIM-Filter: OpenDKIM Filter v2.10.3 aurora-borealis.phear.org 75CCA10A82 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=phear.org; s=20180217; t=1527922725; bh=YISJ7iu/anAHdb1xm3Skwz+FdFgfQX18pJQn+PXv/Ps=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=a1g9WZVTeu+m8ysLPmV5JG2LgxdZWPZn6X+DK3C5c/KjNFCx8MhCnDT93Bl+Xvacg Pm5IGl6nKBhhVZ20JIvNi1vvECcUplnPkKWfOSOjAR6bXJZs3+oJQ2/O7q5urY5EQi olTV3Voyv3UnCtDkDD7sroEadVuwOvW78d/CTh6AIc0/4MdIqdB/4MLMt+53ncND71 XHBPCFJ1ZZ22tTrnwv/YxAl60EyMe0EhJXdO12YtcyIrP473ROzPg3fReE3Pc0gBQ+ KDSBOypJa1gkUOYDLBxZxwLsxdC7M+0UtwgEKqSfNq/apXLPQAPUV1SwzPWtTYDhhF XdEsqJM109Ihg== Date: Sat, 2 Jun 2018 08:58:43 +0200 From: Marc Chantreux To: Bart Schaefer Cc: Zsh Users Subject: Re: read options to slurp empty lines ? Message-ID: <20180602065843.GA22633@prometheus.u-strasbg.fr> References: <20180601214714.GA11281@prometheus.u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.5 (2018-04-13) > > slurp () IFS=$'\n' read -r -d ' -A $1 > I presume that to be a typo or cut-and-paste error because you have an > unmatched single quote there. indeed! slurp () IFS=$'\n' read -r -d '' -A $1 > % typeset -p them > typeset -a them=( bar bang '' ) typeset -p is awesome! thanks for this :) > The behavior of "read" is to collapse multiple consecutive occurrences > of $IFS characters into a single one. and then i feel dump because i know it :( > Only that there's no simple way to make it do what you want. :-) > You're probably looking for this: > slurp() { > local REPLY > IFS= read -d '' && > set -A ${1:-reply} "${(@f)REPLY}" > } much more elegant that mine. thank you! marc