From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15864 invoked from network); 12 Apr 1999 07:20:44 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 12 Apr 1999 07:20:44 -0000 Received: (qmail 2232 invoked by alias); 12 Apr 1999 07:20:34 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6006 Received: (qmail 2225 invoked from network); 12 Apr 1999 07:20:34 -0000 From: "Andrej Borsenkow" To: , Subject: RE: zsh-3.1.5-pws-14: parameter expansion not working properly Date: Mon, 12 Apr 1999 10:51:11 +0400 Message-ID: <003001be84b0$d9790490$21c9ca95@mowp.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 In-Reply-To: Importance: Normal Yes, as I understand, it was changed in pws-14. It includes full description of subst rules in Parameters expansion section of manual. Basically, in quotes, the value of inner substitution is always forced to be scalar for outer substitution unless some flags or modifiers (notably, =, (@), (s)) prevent it. > % zsh-3.1.5-pws-14 > % a=("${(f@)$(echo foo; echo bar)}"); print -l $a > foo > bar (@) is not needed. (f) is already enough - first, the value of $(...) is forced to scalar and then it is splitted using (f) flag. The result is *always* array - in this case it is top-level one so nothing more happens. > % a=("${${(f@)$(echo foo; echo bar)}:#f*}"); print -l $a > Yep. The first ${(f)$(...)} yields array value. The outer ${...} first converts array to scalar (because the whole is quoted) and then applies # to scalar. To preserve "arrayness" you need (@) for outer subst: bor@itsrm2:~%> a=("${(@)${(f@)$(echo foo; echo bar)}:#f*}"); print -l $a bar So, it is not a bug, it is by desing. There was a long thread here, where I tried to understand what ZSH substitution rules actually are. I admit (now :-) that current state is more or less consistent. The problem is, it is near to impossible to explain difference between pws-14 and earlier versions because it is the first time these rules are explicitly stated. /andrej