From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8616 invoked by alias); 31 Mar 2010 06:06:09 -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: 27849 Received: (qmail 2021 invoked from network); 31 Mar 2010 06:06:07 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at spodhuis.org does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d200912; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=73sjI73c4O0ZBtF/Ufydp1GggR6+63/W7XyDoB9QsIY=; b=cCCTWQVoiixhSSMemhXKON3iVYazcfatcSj1ak1v32A4Ws2pbRLCD7IXiOxRu5sM6QrxiU3D1y7a+37BjCz6bbHYrixDGI+XR3YQe5yWtDuL5m9fPca/NWRAeFDGtONBakoGjwQ1F0sTi6qrrL2UpV5gF6CN+TkGRaIqd1WKKgA=; Date: Tue, 30 Mar 2010 23:06:02 -0700 From: Phil Pennock To: Bart Schaefer Cc: zsh-workers@zsh.org Subject: Re: Is this a bug? Why not? Message-ID: <20100331060602.GA91691@redoubt.spodhuis.org> Mail-Followup-To: Bart Schaefer , zsh-workers@zsh.org References: <100330224612.ZM1818@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <100330224612.ZM1818@torch.brasslantern.com> On 2010-03-30 at 22:46 -0700, Bart Schaefer wrote: > macadamia% print $ZSH_VERSION $ZSH_PATCHLEVEL > 4.3.10-dev-1 1.4947 > macadamia% print ${var-???} > CVS Doc Etc Src > macadamia% print ${${var}-???} > > macadamia% print ${${var}+???} > CVS Doc Etc Src > macadamia% print ${${var}:-???} > CVS Doc Etc Src > macadamia% print ${${var}:+???} > > macadamia% So the string ${var} when treated as a variable-name is empty but defined? The four expansions with a nested ${var} are entirely consistent with the behaviour when expanding a variable which is defined with a value of length 0. Seems unusual, but consistent. In bash, ksh, bad substitution. In ksh93, it gets weird: $ echo ${var-???} OSM SCM bin dbg doc etc lib man src tmp www $ echo ${${var}-???} ksh93: syntax error: `!' unexpected The ksh reference-name expansion made me think of the somewhat opposite expansion in zsh, (P)var ... Hrm, zsh 4.3.10 1.4705: % print ${(P)-???} zsh: 0239BCJPXZgiklms: ?? % print ${(P)+???} zsh: bad substitution % print ${(P):-???} OSM SCM bin dbg doc etc lib man src tmp www % print ${(P):+???} % Strange that the first entry is somehow tying into expanding $- for the shell options ... % print ${-} 0239BCJPXZgiklms % print ${(P)-} % print ${(P)-?} zsh: 0239BCJPXZgiklms: parameter not set That strikes me as dubious. You?