Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Help w/compctl & ksh_glob
- X-seq: zsh-users 6473
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Help w/compctl & ksh_glob
- Date: Mon, 18 Aug 2003 15:58:13 +0000
- In-reply-to: <20030818060257.GA15930@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20030816065935.GA31520@xxxxxxxxxxxxxxxxx> <1030816170739.ZM5619@xxxxxxxxxxxxxxxxxxxxxxx> <20030818060257.GA15930@xxxxxxxxxxxxxxxxx>
On Aug 18, 2:02am, Jerry A! wrote:
} Subject: Re: Help w/compctl & ksh_glob
}
} : The documentation for 'compctl -g' may have part of the answer:
} :
} : [...] More than one pattern may be
} : given separated by blanks. (Note that brace expansion is _not_
} : part of globbing. Use the syntax `(either|or)' to match
} : alternatives.)
}
} Actually, {} globbing is valid ksh93 syntax. It's not valid ksh88
} syntax. But I've always pictured zsh's ksh emulation as ksh93
} emulation.
It's valid syntax, but it's not _globbing_ syntax. The meaning of
*.+(b{oo,ar,az}|quu|txt)
is to expand the expression to the three words
*.+(boo|quu|txt) *.+(bar|quu|txt) *.+(baz|quu|txt)
Only _after_ that expansion has occured does globbing apply.
You can see why that must be the case if you consider an expression
*.+(b{oo,a/r,/az}|quu|txt)
which probably results in two invalid glob patterns (it does in zsh,
at least, because alternatives within (|) can't cross directories), but
one pattern which still produces matches. If brace expansion were part
of globbing, the entire expression would be invalid.
In the case of 'compctl -g', globbing is applied directly to the string
without first performing brace expansion, so you must use an additional
layer of (|).
} : However, the real problem is something to do with the SH_GLOB option,
}
} This got the wheel's turning. Turn's out that 'emulate ksh' turns on
} 'SH_GLOB', which in turns disables (|) globbing.
That's not precisely what's happening, because as I said the (|) pattern
works as expected when it's used on the command line (or at least, it
does for me); it fails only in the compctl arguments. I haven't been
able to figure out why yet.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author