patheticpat
patheticpat

Reputation: 841

Confusing ZSH glob

I am having trouble understanding the following glob:

${^fpath}/_git-*~(*~|*.zwc)(.N)

${^fpath} expands the fpath array, (.N) limits matches to regular files and sets the NULL_GLOB option. So far so good. The problem is the _git-*~(*~|*.zwc) part. From my understanding it starts by matching anything that begins with _git- and then excludes everything matching (*~|*.zwc), but what exactly would that be?

Upvotes: 2

Views: 360

Answers (1)

patheticpat
patheticpat

Reputation: 841

I think I figured it out wile trying to come up with a test environment for @lolesque.

The two ~ have different meanings. The first one excludes everything that matches the following pattern while the second one matches a literal ~. So the pattern will match _git-foo, but not _git-foo~ or _git-foo.zwc in any of the directories in fpath.

Upvotes: 0

Related Questions