From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1584 invoked from network); 1 Jun 1999 15:40:22 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Jun 1999 15:40:22 -0000 Received: (qmail 13634 invoked by alias); 1 Jun 1999 15:39:55 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6425 Received: (qmail 13621 invoked from network); 1 Jun 1999 15:39:52 -0000 From: "Bart Schaefer" Message-Id: <990601153644.ZM11011@candle.brasslantern.com> Date: Tue, 1 Jun 1999 15:36:43 +0000 In-Reply-To: <001701beac27$d4c820e0$21c9ca95@mow.siemens.ru> Comments: In reply to "Andrej Borsenkow" "Force globbing inside of parameter substitution" (Jun 1, 4:11pm) References: <001701beac27$d4c820e0$21c9ca95@mow.siemens.ru> X-Mailer: Z-Mail (5.0.0 30July97) To: "Andrej Borsenkow" , "ZSH workers mailing list" Subject: Re: Force globbing inside of parameter substitution MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 1, 4:11pm, Andrej Borsenkow wrote: } Subject: Force globbing inside of parameter substitution } } Suppose, I need a list of files sperated by comma. "${(j/,/)${(f)$(print -rl -- *)}}" You probably don't need the `-r' or the `--', but I'm paranoid. } ${(j/,/)${:-*}} } } Unfortunately, it does not work - it simply results in single `*'. Yes ... filename generation always happens after parameter expansion. } As a side note: it looks, like GLOB_SUBST does not apply in the above case. } I have globsubst off, but the result of ${:-*} is still globbed. Is it } intentional? I would deem it as a bug. The stuff on the RHS of :- (and :+ etc.) is treated as if it were outside the ${ } for purposes of tokenization. That's why POSIX permits quotes to appear inside the braces: so you can do stuff like ${1+"$@"}. I should have remembered that when I brought up quoting yesterday. Interestingly, ${(e):-*} produces an untokenized * (which is not globbed). I'd be more inclined to call _that_ a bug. } Using ${(j/,/)$(print *)} does _almost_ wat I'd like ... with two caveats: } } 1. the file names with spaces are mangled Quoting and print -rl should deal with that. You don't have any file names with newlines, do you? } 2. it is potentially less efficient. Yes. } Is the use of temporary array the only possibility? The only way to avoid a $(...), yes. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com