From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5496 invoked from network); 4 Dec 2003 22:57:08 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 4 Dec 2003 22:57:08 -0000 Received: (qmail 23383 invoked by alias); 4 Dec 2003 22:56:36 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6841 Received: (qmail 23371 invoked from network); 4 Dec 2003 22:56:35 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 4 Dec 2003 22:56:34 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [35.9.66.29] by sunsite.dk (MessageWall 1.0.8) with SMTP; 4 Dec 2003 22:56:34 -0000 Received: from valentino.pa.msu.edu (localhost.localdomain [127.0.0.1]) by valentino.pa.msu.edu (8.12.8/8.12.8) with ESMTP id hB4MuXdB032422 for ; Thu, 4 Dec 2003 17:56:33 -0500 Received: (from juhas@localhost) by valentino.pa.msu.edu (8.12.8/8.12.8/Submit) id hB4MuXcG032420 for zsh-users@sunsite.dk; Thu, 4 Dec 2003 17:56:33 -0500 X-Authentication-Warning: valentino.pa.msu.edu: juhas set sender to juhas@pa.msu.edu using -f Date: Thu, 4 Dec 2003 17:56:33 -0500 From: Pavol Juhas To: zsh-users@sunsite.dk Subject: Re: Why doesn't cd ignore files when you type say "cd fred*" Message-ID: <20031204225633.GA32289@pa.msu.edu> Mail-Followup-To: zsh-users@sunsite.dk References: <1031204173057.ZM17273@candle.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i On Thu, Dec 04, 2003 at 08:50:33PM +0000, zzapper wrote: > Thanx Stephen & Bart > > Can anyone talk me thru the following two expressions I can guess > what they are doing but I'd like to know the principles (which do the > same thing (?)). I'm a zsh newbie and the shell syntax is still a bit > shocking! > > dirs=( "${^@}"(-/N) ) "${^array}"_text expands array to "${array[1]}"_text "${array[2]}"_text ... and so the expression in parenthesis is expanded to ( "$1"(-/N) "$2"(-/N) "$3"(-/N) ... ) (-/N) is a globing qualifier, where '-' specifies that following qualifiers apply to targets of symlinks, '/' requests directories, and so '-/' requires directories or symbolic links that point to directories. 'N' turns on the null_glob option for this pattern, which means that the word is deleted if it does not match a file (otherwise an error message would be printed). You may try this with print no_dir(/) and print no_dir(/N) Summing up ( "${^@}"(-/N) ) is expanded to an array of positional arguments which are directories or symbolic links to directories. Ref: man zshexpn then search for /glob qua/ info zsh filename\ generation zsh reference card from www.zsh.org is also very useful HTH, Pavol