Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why doesn't cd ignore files when you type say "cd fred*"
- X-seq: zsh-users 6841
- From: Pavol Juhas <juhas@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Why doesn't cd ignore files when you type say "cd fred*"
- Date: Thu, 4 Dec 2003 17:56:33 -0500
- In-reply-to: <sv6vsv4m1qah3gdp59rqaospleqcbkpk7d@xxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <kohusvg6jgqkqqtbc5th8h12b61iomo1gr@xxxxxxx> <1031204173057.ZM17273@xxxxxxxxxxxxxxxxxxxxxxx> <sv6vsv4m1qah3gdp59rqaospleqcbkpk7d@xxxxxxx>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author