zsh-users
 help / color / mirror / code / Atom feed
From: Ray Andrews <rayandrews@eastlink.ca>
To: Zsh Users <zsh-users@zsh.org>
Subject: tilde syntax
Date: Thu, 4 Jan 2024 14:31:53 -0800	[thread overview]
Message-ID: <625e7ef5-be1f-4b5d-bb2a-f71634d151cf@eastlink.ca> (raw)

     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.




             reply	other threads:[~2024-01-04 22:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 22:31 Ray Andrews [this message]
2024-01-04 22:49 ` Bart Schaefer
2024-01-04 23:04   ` Ray Andrews
2024-01-04 23:40     ` Lawrence Velázquez
2024-01-05  0:12       ` Ray Andrews
2024-01-05  1:41         ` Lawrence Velázquez
2024-01-05  2:03           ` Ray Andrews
2024-01-05 14:41             ` Mark J. Reed
2024-01-05 16:42               ` Ray Andrews
2024-01-05 19:58                 ` Bart Schaefer
2024-01-05 22:50                   ` Ray Andrews
2024-01-05 23:27                     ` Bart Schaefer
2024-01-05 23:47                       ` Ray Andrews
2024-01-06  0:23                         ` Bart Schaefer
2024-01-06  3:44                           ` Ray Andrews

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=625e7ef5-be1f-4b5d-bb2a-f71634d151cf@eastlink.ca \
    --to=rayandrews@eastlink.ca \
    --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).