Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tilde syntax
On Thu, Jan 4, 2024 at 2:32 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> subdirs=( $~zsh_case$1*(/N) ) # This works: but tilde must follow
> first dollar sign
>
> [...] what does the tilde really do?
Results of parameter expansion by default (in native zsh emulation)
are not subject to further interpretation. The tilde says that it's
OK to interpret the result as part of a pattern (globbing or string
comparison, depending on context).
> The tilde turns globing into pattern matching, yes?
No, it turns "do nothing else" into "also act as a glob or pattern".
In this example, it's a glob.
> But '(#i)' works if literal, it's not mistaken for a glob pattern
What do you mean by "works"? With extendeglob set, it IS a (glob)
pattern, it's the pattern than means "the rest of this pattern is case
insensitive".
Messages sorted by:
Reverse Date,
Date,
Thread,
Author