From: Pavol Juhas <juhas@pa.msu.edu>
To: zsh-users@sunsite.dk
Subject: Re: Why doesn't cd ignore files when you type say "cd fred*"
Date: Thu, 4 Dec 2003 17:56:33 -0500 [thread overview]
Message-ID: <20031204225633.GA32289@pa.msu.edu> (raw)
In-Reply-To: <sv6vsv4m1qah3gdp59rqaospleqcbkpk7d@4ax.com>
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
prev parent reply other threads:[~2003-12-04 22:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-04 14:54 zzapper
2003-12-04 15:37 ` Peter Stephenson
2003-12-04 16:47 ` zzapper
2003-12-05 10:54 ` Oliver Kiddle
2003-12-05 11:06 ` zzapper
2003-12-05 14:27 ` Oliver Kiddle
2003-12-04 17:30 ` Bart Schaefer
2003-12-04 20:50 ` zzapper
2003-12-04 22:56 ` Pavol Juhas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031204225633.GA32289@pa.msu.edu \
--to=juhas@pa.msu.edu \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).