From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28606 invoked from network); 20 Aug 2004 16:09:24 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 20 Aug 2004 16:09:24 -0000 Received: (qmail 76122 invoked from network); 20 Aug 2004 16:09:17 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 20 Aug 2004 16:09:17 -0000 Received: (qmail 6061 invoked by alias); 20 Aug 2004 16:07:16 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7896 Received: (qmail 6050 invoked from network); 20 Aug 2004 16:07:16 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 20 Aug 2004 16:07:16 -0000 Received: (qmail 70984 invoked from network); 20 Aug 2004 16:05:18 -0000 Received: from unknown (HELO moonbase.zanshin.com) (167.160.213.139) by a.mx.sunsite.dk with SMTP; 20 Aug 2004 16:05:16 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.12.11/8.12.11) with ESMTP id i7KG5EfD014490 for ; Fri, 20 Aug 2004 09:05:14 -0700 Date: Fri, 20 Aug 2004 09:05:14 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-users@sunsite.dk To: zsh-users@sunsite.dk Subject: Re: In the tla completion function: "${(@P)var_cmd-*:FILE:_files}" In-Reply-To: <20040820085546.GA1174@s> Message-ID: References: <20040816213204.GA6795@s> <20040817005205.GB2869@iup.edu> <20040820085546.GA1174@s> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-1.4 required=6.0 tests=BAYES_20 autolearn=no version=2.63 X-Spam-Hits: -1.4 On Fri, 20 Aug 2004, Haakon Riiser wrote: > [Jason McCarty] > > > > if $var_cmd is not defined, I'd expect the expansion to give the > > > string after the '-': > > > > $var_cmd is always defined to something of the form "cmd_*" on line 658. > > Hmm, strange that my shell gives 'bad substitution' when var_cmd > is not defined. So does Jason's, I'm sure. Jason's point is that var_cmd should NEVER BE "not defined" in the _tla function. It's defined at the point where it's declared, to be the second word on the command line. > % unset var_cmd > % echo "${(@P)var_cmd-*:FILE:_files}" > zsh: bad substitution It is a little odd that ${(P)unset+full} and ${(P)unset-empty} don't both give this error. Compare ${-empty} and ${:-empty} as well. In any case the workaround is to use the ${(P)unset:-empty} form.