Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

tilde syntax



    local zsh_case='(#i)'    # insensitive
    # Depending on options: zsh_case=''

    # Where input is some directory name, possibly incomplete and matches are looked for:

    subdirs=( $1*(/N) )

    subdirs=( (#i)$1*(/N) )

    subdirs=( $~zsh_case$1*(/N) ) # This works: but tilde must follow first dollar sign


The first two seem intuitive,  but the 3d, what does the tilde really do?  It has to be there, but one might expect '$zsh_case' to just substitute and all's well.  I used to understand this, I remember Roman explaining it, but I can't remember and my notes are sketchy.  The tilde turns globing into pattern matching, yes? But '(#i)' works if literal, it's not mistaken for a glob pattern so why should the use of a variable change anything?  Again, pardon, I used to know this.






Messages sorted by: Reverse Date, Date, Thread, Author