From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24831 invoked by alias); 13 Mar 2015 10:49: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: X-Seq: 20000 Received: (qmail 3777 invoked from network); 13 Mar 2015 10:49:51 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.2 X-Virus-Scanned: amavisd-new at amavis-1.icm.edu.pl Date: Fri, 13 Mar 2015 11:42:36 +0100 From: Michal Politowski To: zsh-users@zsh.org Subject: Re: (s,:,) made right ("" is also an element) Message-ID: <20150313104236.GA31303@meep.pl> Mail-Followup-To: zsh-users@zsh.org References: <20150313101208.GA5325@ramirez.u-strasbg.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <20150313101208.GA5325@ramirez.u-strasbg.fr> User-Agent: Mutt/1.5.23 (2014-03-12) On Fri, 13 Mar 2015 11:12:08 +0100, Marc Chantreux wrote: > hello,=20 >=20 > say i have >=20 > PATH=3D"/usr/bin::/bin"=20 > print -l ${(s,:,)PATH} > foo=3D( ${(s,:,)PATH} ) > print $#foo >=20 > because i have an empty element (which is also an element) >=20 > i got >=20 > /usr/bin > /bin > 2 >=20 >=20 > i expect >=20 > /usr/bin >=20 > /bin > 3=20 >=20 > does someone know how to fix zsh? print -l "${(@s,:,)PATH}" foo=3D("${(@s,:,)PATH)") It's described in the manual: For historical reasons, the usual behaviour that empty array elements are retained inside double quotes is disabled for arrays generated by splitting; hence the following: line=3D"one::three" print -l "${(s.:.)line}" produces two lines of output for one and three and elides the empty field. To override this behaviour, supply the "(@)" flag as well, i.e. "${(@s.:.)line}". --=20 Micha=B3 Politowski Talking has been known to lead to communication if practiced carelessly.