From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@zsh.org
Subject: Re: difference between ~ & ^ negation
Date: Thu, 2 Jan 2014 21:01:47 +0000 [thread overview]
Message-ID: <20140102210147.0eca0601@pws-pc.ntlworld.com> (raw)
In-Reply-To: <140101134459.ZM8931@torch.brasslantern.com>
On Wed, 01 Jan 2014 13:44:59 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Important note: ^ is special only in cases where / is special (globs).
That's not true...
setopt extendedglob
[[ foo = ^foo ]] || print foo actually is foo
[[ bar = ^foo ]] && print but bar is not foo
"^" is still special here; the difference is that if a "/" appeared
after it *that* wouldn't be special in this context, i.e. the effect of
the "^" would extend to the end of the context (next closing parenthesis
or end of string). However, that's the normal behaviour of operators
--- only ~ extends over "/"s in file context. As the FAQ says,
Note that `~' is the only globbing operator to have a lower
precedence than `/'. For example, `**/foo~*bar*' matches any
file in a subdirectory called `foo', except where `bar'
occurred somewhere in the path (e.g. `users/barstaff/foo' will
be excluded by the `~' operator). As the `**' operator cannot
be grouped (inside parentheses it is treated as `*'), this is
one way to exclude some subdirectories from matching a `**'.
The form (^foo/)# also works.
pws
next prev parent reply other threads:[~2014-01-02 21:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-01 15:28 zzapper
2014-01-01 21:44 ` Bart Schaefer
2014-01-02 21:01 ` Peter Stephenson [this message]
2014-01-02 21:36 ` Bart Schaefer
2014-01-02 22:14 ` Peter Stephenson
2014-01-03 1:55 ` Mikael Magnusson
2014-01-03 7:37 ` Bart Schaefer
2014-01-03 19:48 ` Peter Stephenson
2014-01-03 20:10 ` Peter Stephenson
2014-01-03 21:43 ` Bart Schaefer
2014-01-04 21:11 ` zzapper
2014-01-05 10:01 ` Eike von Seggern
[not found] ` <8lp61n01B02mHnv01lp8uc>
2014-01-03 20:56 ` how to shut off auto spell steve
2014-01-03 21:52 ` Bart Schaefer
[not found] ` <9ZwH1n01Z02mHnv01ZwLWZ>
2014-01-03 22:07 ` steve
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=20140102210147.0eca0601@pws-pc.ntlworld.com \
--to=p.w.stephenson@ntlworld.com \
--cc=zsh-users@zsh.org \
/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).