From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20508 invoked by alias); 1 Sep 2013 22:34:50 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31682 Received: (qmail 6235 invoked from network); 1 Sep 2013 22:34:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,FREEMAIL_REPLYTO,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.219.68 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:date:message-id:subject:from:to:content-type; bh=ADOjrKEwjRNacpEV8IoY36Y4qQ5DtgW8W4GC+G7WIXU=; b=bJCflFyXh1J89GqqW270wPqBcFDZNuLssRApfYmUxoOPjePzFBQ1YOKV/x187gHIGx BFVywORlRreMZO1TJcrK6IXBnfTxZPOuLT4QX40s5C1bFMAZHOzwaggvunL3q3dCMlfg 9vWuZrjRw7nmNDOpXfZlZ7fEQWrulRzOLSh5RE+Ktv6ulALAy6iIzkoZJl2vkX7UjKhP pXyFYebCeI17LiqdKZc8Z12YvaR8fwmmJsx0a45lGNElRnvXwyiXLtfUV/x0n6tW7pDt 2eyGelD4KkSm+gtZgpX8I5hcBxivygVub7pxMQ/ck3mAH/SYK36e52ZE/4/QJsgLj91/ XWzA== MIME-Version: 1.0 X-Received: by 10.182.214.98 with SMTP id nz2mr15002122obc.37.1378074879078; Sun, 01 Sep 2013 15:34:39 -0700 (PDT) Reply-To: linuxtechguy@gmail.com Date: Sun, 1 Sep 2013 17:34:38 -0500 Message-ID: Subject: The Z Shell Manual, zsh/mapfile documentation correction From: Jim To: zsh-workers@zsh.org Content-Type: multipart/alternative; boundary=e89a8ff1cefea4350504e55a0fbc --e89a8ff1cefea4350504e55a0fbc Content-Type: text/plain; charset=ISO-8859-1 Hello, While working on a zsh script, I researched using module zsh/mapfile to read a file into an array for further processing. Trying the example from *The Z Shell Manual*(Section 22.15) I found that it didn't work as stated. It failed to read in blank lines. I had also noticed an extra element in the array. Example: array=("${(f)mapfile[*filename*]}") also egrep -v '^$' filename | wc -l yielded n lines print ${#array} yielded n+1 elements Not that I needed the blank lines, in this case, but it did not read them into the array. After some web searching I found that this was discussed on zsh-users in the 2008 thread *reading a file into an array. mapfile? (f)? *. URL: http://www.zsh.org/mla/users/2008/msg00849.html. The fix was actually stated in URL: http://www.zsh.org/mla/users/2008/msg00874.html. Correction: array=("${(f@)mapfile[*filename*]}") The discussion also stated the fact that an extra element(blank) is added to the end of the array. It would be nice to have a statement in *The Z Shell Manual* that the array will contain an additional element. I'm not sure I agree that this should be the result, but I'll leave that to others more knowledgeable about the subject. Versions of the manual I checked are: 4.3.17 -- This is also the version of zsh I'm using(OS: Debian Wheezy). 5.0.2-dev-0 Sincerely, Jim --e89a8ff1cefea4350504e55a0fbc--